MobbID Cordova: Face Identification
Introduction
MobbID allows you to perform several biometric operations between the user that has been previously enrolled and the user using the app. This process performs a face recognition between the user's face and the face that was previously enrolled in a biometric group (1:N).
In the next section, the details of this method will be exposed.
MobbIdApi.faceIdentification
This method opens the camera UI and starts the face identification process. The method has four parameters:
successCallback: Function which will be called when the face identification finishes successfully. It will receive an object with the following attributes:result: This could be"USER_IDENTIFIED"or"USER_NOT_IDENTIFIED".data: Extra data about the identification result, it contains the following attributes:users: Array of users that have been identified in a ranked order. Each user has the following attributes:userId: Identifier of the user that has been identified.score: Score of the identification.
failureCallback: Function which will be called when the face identification fails for any reason. It will receive an object with the following attributes:result: This could be"ERROR".error: Error that happened in the process. It contains the following attributes:code: Error code.extraInfo: Error message.
groupId: Identifier of the group that contains the users that are going to be identified. If not provided, the default group will be used.livenessDetectionMode: liveness detection mode. It could be"NONE","HEAD_MOVEMENT","HEAD_PASSIVE"or"HEAD_PASSIVE_IMAGE".
Example
MobbIdApi.faceIdentification(
function (result) {
console.log("Face identification success: " + result.result);
console.log("Users identified: " + JSON.stringify(result.data.users));
},
function (error) {
console.log("Face identification error: " + error.code);
console.log("Error message: " + error.extraInfo);
},
"group_id",
"HEAD_PASSIVE_IMAGE"
);
