Selfie Acquisition
Captures a user's selfie for face authentication or face registration
About client-facing steps
A journey is a sequence of steps that are executed when it's invoked by a client application (known as the "client"). Some steps require involvement from the client, such as to collect user input. Other steps, like validating a token, are executed in the backend by the Mosaic journey engine alone.
When invoked, the journey begins executing the steps while the client waits for further instructions. When a journey reaches a client-facing step, the journey asks the client for the required input and then waits for the client to respond. The client presents their own UI if user interaction is required, and returns input to the journey. The journey then proceeds in a similar manner until it's completed.
Description
This client-facing step is used to obtain a selfie image from the user and pass it to Mosaic Identity Verification for further processing. This step is essential for face authentication scenarios where the user needs to prove their identity in real-time.
After triggering this step, Mosaic creates the Identity Verification session. The client receives the session start token from the Orchestration SDK and uses it to invoke Identity Verification SDK (iOS or Android) in order to proceed with selfie image acquisition.
Note for mobile developers
- Make sure the Identity Verification SDK is configured to work in the same region as other Mosaic services.
- For details on how to set up and initialize the Identity Verification SDK for mobile apps, see Steps 2 & 3 of Android quickstart or iOS quickstart .
If the step is successful, the journey stores the selfie data in the output variable and proceeds to the next step, typically the Face Authentication or Register face step.
If it fails (e.g., user didn't upload the picture), the journey is aborted and an error is sent to the client.
Configuration
Field | Description |
---|---|
Output variable | Name of the variable that stores selfie data |
Error output variable | Name of the variable that stores any errors returned by action |
Example
When executed, this step sends a callback to the client with the IDO service response object. It will have the journeyStepId
set to selfieAcquisition
and the data will include a start_token
generated implicitly by the IDO service. The client invokes Identity Verification SDK to collect a selfie. The client then submits the response to the journey using the Orchestration SDK call.
private fun processServiceResponse(idoResponse: TSIdoServiceResponse) {
when (idoResponse.journeyStepId) {
TSIdoJourneyActionType.SelfieAcquisition.type -> handleSelfieAcquisition(idoResponse)
}
}
private fun handleSelfieAcquisition(idoResponse: TSIdoServiceResponse) {
var idvStartToken = idoResponse.responseData?.optString("start_token")
idvStartToken?.let { token ->
activity?.applicationContext?.let {
TSIdentityVerification.initializeSDK(it)
TSIdentityVerification.registerForStatus(object: ITSIdentityVerificationStatus{
...
override fun verificationCompleted() {
TSIdo.submitClientResponse(TSIdoClientResponseOptionType.ClientInput.type, null, callback)
}
override fun verificationFail(p0: TSIdentityVerificationError) {
if (idoResponse.clientResponseOptions?.get(TSIdoClientResponseOptionType.Fail.type) != null) {
TSIdo.submitClientResponse(TSIdoClientResponseOptionType.Fail.type, null, callback)
} else {
//handle failure
}
}
...
})
TSIdentityVerification.start(it, idvStartToken)
}
}
}
class ExampleClass: TSIdentityVerificationDelegate {
func TSIdoDidReceiveResult(_ result: Result<IdentityOrchestration.TSIdoServiceResponse, IdentityOrchestration.TSIdoJourneyError>) {
switch result {
case .success(let response):
switch response.journeyStepId {
case .selfieAcquisition:
// Run IDV module
guard let startToken = response.data?["start_token"] as? String else {
debugPrint("Start token is missing")
return
}
// Initialize IDV SDK if not initialized
TSIdentityVerification.initialize(baseUrl: "[BASE_URL]", clientId: "[CLIENT_ID]")
// Set delegate to receive IDV callbacks
TSIdentityVerification.mosaicUIDelegate = self
// Start IDV with Mosaic UI
TSIdentityVerification.startWithMosaicUI(startToken: startToken)
default:
break
}
case .failure(let error):
// Handle error
break
}
}
}
extension ExampleClass: TSIdentityVerificationMosaicUIDelegate {
func mosaicUIVerificationDidComplete() {
try? TSIdo.submitClientResponse(clientResponseOptionId: .clientInput)
}
func mosaicUIVerificationDidCancel() {
try? TSIdo.submitClientResponse(clientResponseOptionId: .cancel)
}
func mosaicUIVerificationDidFail(with error: TSIdentityVerificationError) {
try? TSIdo.submitClientResponse(clientResponseOptionId: .fail)
}
}