Quick start
This guide walks you through a complete face verification: your backend issues a token, the app captures the user's face with passive liveness, MobbID compares it with the user's enrolment (1:1) and your backend confirms the result.
| # | Step | Call |
|---|---|---|
| 1 | Obtain a token | In your backend |
| 2 | Initialise | initSdk() |
| 3 | Verify the face | faceVerification() |
| 4 | Confirm the result | In your backend |
- The plugin is installed.
- The user is enrolled. Enrol users from your backend with the Server API, or with the native Android and iOS SDKs.
1. Obtain a token in your backend
The plugin authenticates with a temporary authToken, so the API key never reaches the device. Your backend requests the token with Get an authorization token, using the SDK role API key, and returns the authToken to the app:
curl "https://{SERVER-URL}/api/v7/authorization" \
-H "applicationId: YOUR_APPLICATION_ID" \
-H "apiKey: YOUR_SDK_API_KEY"
The token is valid for 30 minutes.
2. Initialise the plugin
The plugin is available once the platform is ready:
MobbIdApi.initSdk(
() => { /* the plugin is ready */ },
(error) => { /* see Error codes */ },
'YOUR_APPLICATION_ID',
authToken, // issued by your backend
'https://{SERVER-URL}', // your MobbID environment
);
3. Verify the face
faceVerification opens the capture screen, checks liveness and compares the face with the user's enrolment:
MobbIdApi.faceVerification(
(result) => {
// result.result: 'USER_VERIFIED' | 'USER_NOT_VERIFIED'
// result.data.operationId: send it to your backend
},
(error) => { /* see Error codes */ },
userId,
'HEAD_PASSIVE_IMAGE',
);
See Face verification for the parameters and the result.
4. Confirm the result in your backend
The result received by the app drives the user interface only. Send the operationId to your backend, which reads the operation using an API role token. Grant access only when status is SUCCESS and data.result is true.
See Operation lifecycle in the server integration guide.