MobbID Cordova: Face Enrollment
Introduction
MobbID provides a method to enroll a user's face in your application.
In the next section, the details of this method will be exposed.
MobbIdApi.faceEnrollment
This method opens the camera UI and starts the face enrollment process. The method has four parameters:
successCallback
: Function which will be called when the face enrollment finishes successfully. It will receive an object with the following attributes:result
: This could be"USER_ENROLLED"
or"USER_NOT_ENROLLED"
.data
: Extra data about the enrollment result, it contains the following attributes:userId
: Identifier of the user that has been enrolled.
failureCallback
: Function which will be called when the face enrollment fails for any reason. It will receive an object with the following attributes:result
: This could be"ERROR"
.data
: data about the operation, it contains the following attributes:userId
: Identifier of the user that has been enrolled.
error
: Error that happened in the process. It contains the following attributes:code
: Error code.extraInfo
: Error message.
userId
: Identifier of the user that is going to be enrolled.livenessDetectionMode
: liveness detection mode. It could be"NONE"
,"HEAD_MOVEMENT"
,"HEAD_PASSIVE"
or"HEAD_PASSIVE_IMAGE"
.
Example
MobbIdApi.faceEnrollment(
function (result) {
console.log("Face enrollment success: " + result.result);
console.log("User enrolled: " + result.data.userId);
},
function (error) {
console.log("Face enrollment error: " + error.code);
console.log("Error message: " + error.extraInfo);
},
"user@test.com",
"HEAD_PASSIVE"
);