Applicant actions

There is a special way to use the SDK in order to perform Applicant actions.



Currently, only the Face authentication action is supported.

Action level

To run the SDK in applicant action mode, you need to associate your applicant level with a customization of the Applicant actions type in the Dashboard. Also, it is required to make an access token not only with the userId and levelName parameters, but with externalActionId as well.

Aside from the notes above, you manage the SDK the same way you do with regular levels, the only difference is in how you get the action results.

When an action is completed, the sdk.status will be set to .actionCompleted and sdk.actionResult will contain the outcome of the last action invocation.

You can use onDidDismiss, dismissHandler or onStatusDidChange callback in order to determine the SDK status and get the action result.

For example:

sdk.onDidDismiss { (sdk) in

    switch sdk.status {

    case .failed:
        print("failReason: [\(sdk.description(for: sdk.failReason))] - \(sdk.verboseStatus)")

    case .actionCompleted:
        // the action was performed or cancelled

        if let result = sdk.actionResult {
            print("Last action result: actionId=\(result.actionId) answer=\(result.answer ?? "<none>")")
        } else {
            print("The action was cancelled")

        // in case of an action level, the other statuses are not used for now,
        // but you could see them if the user closes the sdk before the level is loaded

Action result

The action result is represented by the sdk.actionResult property that contains the following fields:

actionIdStringApplicant action identifier to check the results against the server.
answerStringOverall result. Typical values are GREEN, RED or ERROR.

The absence of the sdk.actionResult means that the user has cancelled the process.

Result handler

In addition, there is an optional actionResultHandler that allows you to handle the action result upon its arrival from the backend.

The user sees the Processing screen at this moment.

sdk.actionResultHandler { (sdk, result, onComplete) in

    print("actionResultHandler: actionId=\(result.actionId) answer=\(result.answer ?? "<none>")")

    // you are allowed to process the result asynchronously, just don't forget to call `onComplete` when you finish,
    // you could pass `.cancel` to force the user interface to close, or `.continue` to proceed as usual



onComplete must be executed at the end of processing.