Face Session Flow

Note: This feature requires an additional permission and must be explicitly requested

This feature can be used to initiate a facial recognition session based on an image (e.g. id photo) provided through our API (see "Face Session API" in the API documentation). Below you can find an example to initiate the face session.

The following method should be called when the application is initiated:

UqudoSDK.init(applicationContext)

You require an authorisation token from the Uqudo API using the credentials for your account.

val uqudo = UqudoBuilder.FaceSession()
   .setToken(authorizationToken)
   .setSessionId(sessionId)
   .build(requireContext())
startActivityForResult(uqudo, REQUEST_CODE)

Configuration options

The configuration options are described below:

Handling the Result

The face session result will be available to the application in the calling Activityโ€™s onActivityResult method:

...
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
   super.onActivityResult(requestCode, resultCode, data)
   if (resultCode == Activity.RESULT_OK) {
       val result = data?.getStringExtra("data")
   } else if (resultCode == Activity.RESULT_CANCELED) {
       if (data != null) {
         val sessionStatus = data.getParcelableExtra("key_session_status") as SessionStatus
         println("Enrollment failed due to ${sessionStatus.sessionStatusCode.message} at ${sessionStatus.sessionTask.name()}")
       }
   }
}

If the resultCode is equals to Activity.RESULT_OK you can find the SDK result in the data attribute. The string is the JWS, see "SDK result (Face Object)" for details.

If the resultCode is equals to Activity.RESULT_CANCELED you can find the SessionStatus object result in the data attribute under the key โ€œkey_session_statusโ€. The SessionStatus contains the following properties:

sessionStatusCode as SessionStatusCode enum that contains the following error codes:

  1. USER_CANCELLED = User canceled the enrollment process

  2. SESSION_EXPIRED = Session expired or not found

  3. UNEXPECTED_ERROR = Something went wrong. In the message the details of the error

  4. SESSION_INVALIDATED_FACE_RECOGNITION_TOO_MANY_ATTEMPTS = Session gets invalidated because of too many failed facial recognition attempts

sessionTask as SessionTask enum that contains the following codes:

  1. SCAN = The scanning task

  2. READING = The NFC reading task

  3. FACE = The facial recognition task

  4. BACKGROUND_CHECK = The background check task

data as String that contains the JWS object with the partial data of an incomplete KYC session. Returning the partial data for an incomplete KYC session is disabled by default, please see the configuration options available.

Last updated