Enable support for Account Defender

v3.0

In order to enable Account Defender, a user ID must be set. You can set it by calling the PerimeterX/setUserId(userId:forAppId:) function with a non nil value. When the current user logout, you should call this function again with nil. This will turn off the Account Defender.

1do {
2 try PerimeterX.setUserId(userId: "<the current user ID>")
3}
4catch {
5 print("error: \(error)")
6}

In order to tell Account Defender about the user’s flow, you should call the PerimeterX/registerOutgoingUrlRequest(url:forAppId:) function for each URL request that been send to your server. Notice that when the PXPolicy/urlRequestInterceptionType is set to any value rather than PXPolicyUrlRequestInterceptionType/none, the SDK registers URL requests automatically and you don’t need to call this function.

1do {
2 try PerimeterX.registerOutgoingUrlRequest(url: "<URL>")
3}
4catch {
5 print("error: \(error)")
6}

You may add additional data using the PerimeterX/setAdditionalData(parameters:forAppId:) function.

1do {
2 var additionalData = [String: String]()
3 additionalData["key1"] = "value1"
4 additionalData["key2"] = "value2"
5 try PerimeterX.setAdditionalData(parameters: additionalData)
6}
7catch {
8 print("error: \(error)")
9}