Enable support for Account Defender

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 null value. When the current user logout, you should call this function again with null. This will turn off the Account Defender. 

1try {
2 PerimeterX.setUserId("<the current user ID>", null)
3}
4catch {
5 println("error: ${exception.message}")
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.

1try {
2 PerimeterX.registerOutgoingUrlRequest("<URL>", null)
3}
4catch {
5 println("error: ${exception.message}")
6}

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

1try {
2 PerimeterX.setAdditionalData(hashMapOf("key1" to "key2", "key2" to "value2"), null)
3}
4catch {
5 println("error: ${exception.message}")
6}