Handlers
We provide you with the following handlers:
Tip
Handlers are optional, but we encourage you to provide at least
tokenExpirationHandler
to make sure the access token is active.
Token expiration
Because of the limited lifespan of the access token, it is important that you are able to handle the situation where the token expires and needs to be refreshed.
As a solution to this, you set tokenExpirationHandler
. The handler should make a call to your backend, obtain the newToken
, and then pass it back to the SDK by running the onComplete
closure.
sdk.tokenExpirationHandler { (onComplete) in
get_token_from_your_backend { (newToken) in
onComplete(newToken)
}
}
Note
onComplete
must be executed even if you fail to provide a new token; just passnil
in this case.
Verification completion
You can use verificationHandler
to be informed when the verification process has been concluded with a final decision.
The parameter isApproved
lets you know if the applicant was approved or finally rejected. If you'd like to get notified about any other stages of the verification process, use onStatusDidChange
described in Status updates notification.
sdk.verificationHandler { (isApproved) in
print("verificationHandler: Applicant is " + (isApproved ? "approved" : "finally rejected"))
}
Dismissal control
You can take over the dismissal control by assigning dismissHandler
. The handler takes the current sdk
instance and the mainVC
controller. It's up to you to dismiss the mainVC
in the manner that you see fit.
sdk.dismissHandler { (sdk, mainVC) in
mainVC.dismiss(animated: true, completion: nil)
}
Updated about 1 year ago