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:

PropertyTypeOptionalDefaultDescription

setToken(token)

String

No

null

setSessionId(id)

String

No

null

The session id returned by the “Face Session API”, see API documentation

setNonce(nonce)

String

Yes

null

Nonce provided by the customer mobile application when the SDK is initiated. It is useful to make sure the process has been initiated by the customer mobile application. It should be generated server side.

disableSecureWindow()

None

Yes

false

Whether to allow users to take screenshots and capture screen recording or not.

setMinimumMatchLevel(matchLevel)

Int

Yes

None

Defines the minimum match level that the facial recognition has to meet.

enableAuditTrailImageObfuscation(obfuscationType)

ObfuscationType

Yes

None

Enables audit trail image background obfuscation leaving only the face visible. It can be used when there are privacy concerns related to the background of the selfie taken by the user and shared in the SDK result. There are two types of obfuscations:

  • FILLED: the background is entirely replaced

  • FILLED_WHITE: the background is entirely replaced with a wihte background

  • BLURRED: the background is heavily blurred, making sure the objects in the background are not clearly recognizable, but still giving a perception of the environment surrounding the user and therefore still being able to validate the reality of the image. If privacy is a concern, we recommend using this option

setMaxAttempts(maxAttempts)

Int

Yes

3

Set the max failed facial recognition attempts before dropping the session. Note: only values between 1 and 3 are taken into consideration.

returnDataForIncompleteSession()

None

Yes

false

When enabled, if the user or the SDK drops the session before completion and there was at least one failed facial recognition attempt, the SDK will return the partial data together with the SessionStatus object in the data attribute, that will contain the same JWS string that is returned in a successful scenario

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