Mobile SDK Face Authentication (online)
Face Authentication
Face Authentication is an Incode Module that asks a user to take a photo of their face ("selfie"). The selfie is then compared to a previously-onboarded user to verify the user is who they claim to be.
Prerequisite
You must add the Face Authentication module to a Flow or Workflow on the Incode Dashboard before you can use it in your identity verification process.
Integration options
Low-code integration
- Using
startFloworstartWorkflowmethods
Full SDK integration
- Face Authentication can be setup via SDK and used in
startOnboardingorstartOnboardingSectionmethods.
All integrations start with initialization of the SDK, as shown in the following image.
Android
public static void IncodeSDKInitialize(Application app) {
try {
new IncodeWelcome.Builder(app, Constants.API_URL, Constants.API_KEY)
.setLoggingEnabled(true)
.build();
incodeSDKInitialized = true;
} catch (Exception exception) {
incodeSDKInitialized = false;
}
}
private void setIncodeCommonConfig() {
CommonConfig commonConfig = new com.incode.welcome_sdk.CommonConfig.Builder()
.setShowExitConfirmation(true)
.setShowCloseButton(true)
.build();
IncodeWelcome.getInstance().setCommonConfig(commonConfig);
}
Swift
func incodeSDKInitialize(api_url: String, api_key: String) {
IncdOnboardingManager.shared.initIncdOnboarding(url: api_url,
apiKey: api_key,
loggingEnabled: true,
testMode: testMode) { (success, error) in
print("IncdOnboarding SDK initialization, success: \(success == true), error: \(error?.description ?? \"nil\")")
self.dispatchGroup.leave()
}
}
func setIncodeCommonConfig() {
IncdOnboardingManager.shared.allowUserToCancel = true
IncdOnboardingManager.shared.idBackShownAsFrontCheck = true
IncdOnboardingManager.shared.idFrontShownAsBackCheck = true
}
JavaScript
const IncodeSDKInitialize = (API_URL, API_KEY) => {
IncodeSdk.initialize({
testMode: false,
apiConfig: {
url: API_URL,
key: API_KEY,
}
})
.then((_) => {
console.log('Incode SDK init success')
})
.catch((e) => {
console.error('Incode SDK failed init', e);
});
};
If you configure a 1:1 Face Authentication method on the Dashboard, you should provide a login hint before starting the Face Authentication module. The login hint can be phone, email, or identityId (that is, the ID of a user who has been successfully onboarded previously).
Set Face Authentication Hint
Android
IncdWelcome.getInstance().setFaceAuthenticationHint("identityId")
Swift
IncdOnboardingManager.shared.faceAuthenticationHint = "identityId"
JavaScript
await IncodeSdk.setFaceAuthenticationHint({ faceAuthenticationHint: 'identityId' });
Low-code integration
A low-code integration allows you to configure Face Authentication completely on the Incode Dashboard and call SDK methods to start a Flow or Workflow.
If you use a Flow, and Face Authentication fails, the flow is aborted. If you use the preferred Workflow method, and Face Authentication fails, the user continues through the steps you configure for this scenario.
Full SDK integration
Full SDK integration allows you to setup Face Authentication inside a startOnboarding or Sections implementation method.
Step 1: Configure a Flow on Dashboard
On the Incode Dashboard, create a Flow that contains the Face Authentication module. This is where you can configure the module to use 1:1 or 1:N, as well as many other settings. Each setting is defined in the documentation for the Face Authentication module.
Step 2: Setup a session
Set up a session using the Flow ID from the previous step as a configurationId.
Android
private SessionConfig getSimpleSession() {
SessionConfig sessionConfig = new SessionConfig.Builder()
.setConfigurationId("configurationId")
.build();
return sessionConfig;
}
Swift
func createSessionConfiguration() -> IncdOnboardingSessionConfiguration {
return IncdOnboardingSessionConfiguration(regionCode: "ALL",
configurationId: "configurationId")
}
JavaScript
function getSimpleSession() {
let sessionConfig: {
region: 'ALL',
configurationId: 'configurationId',
};
return sessionConfig;
}
Step 3: Create a Flow
Add Face Authentication to the Flow as shown here.
Android
private FlowConfig getFlowConfig() {
FlowConfig flowConfig = null;
try {
flowConfig = new FlowConfig.Builder()
.addFaceAuthentication()
.build();
} catch (ModuleConfigurationException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return flowConfig;
}
Step 4: Use startOnboarding or Sections
Call the startOnboarding method and provide sessions and Flow configurations you created previously, as shown here.
Android
IncodeWelcome.getInstance().startOnboarding(activityContext, mSessionConfig, mFlowConfig, onboardingListener);
Swift
IncdOnboardingManager.shared.startOnboarding(sessionConfig: sessionConfig, flowConfig: flowConfig, delegate: self)