onIDVServerBiometricAuthenticationResult

Event: onIDVServerBiometricAuthenticationResult

šŸ“Œ Overview

onIDVServerBiometricAuthenticationResult is an event triggered by the Ditto ID SDK after the selfie biometric authentication process is completed. It returns the status of the authentication by comparing the captured selfie with the stored biometric template on the server.


🧠 Purpose

This event communicates the result of the authentication attempt and helps the app take action based on the outcome.


šŸ“„ Trigger Source

Triggered after calling:

initiateIDVServerBiometricAuthentication();

šŸ“Ø Payload Structure

{
  "status": "SUCCESS" | "FAILED",
  "errorCode": 0,
  "message": "Authentication successful"
}

šŸ”‘ Payload Fields

FieldTypeDescription
statusstringIndicates the outcome of the authentication: SUCCESS or FAILED
errorCodeintNumeric code indicating error cause if any (0 for success)
messagestringDescription of the authentication result

āŒ Error Code Reference

Error CodeDescriptionAction
0Authentication successfulProceed
101No biometric template foundPrompt biometric opt-in
201Poor selfie image qualityRetry selfie capture
301Authentication match failedRetry or use fallback auth

āœ… On Success

  • Allow user to proceed with secured operation or screen

āŒ On Failure

  • Inform the user
  • Provide retry option or fallback (e.g., password login)

Code Snippets for Handling onIDVServerBiometricAuthenticationResult

React Native
eventEmitter.on('onIDVServerBiometricAuthenticationResult', (result) => {
  if (result.status === 'SUCCESS') {
    // Navigate to secure screen
  } else {
    console.warn('Authentication failed:', result.message);
    // Show retry/fallback
  }
});
Flutter
rdna.onIDVServerBiometricAuthenticationResult((result) {
  if (result['status'] == 'SUCCESS') {
    // Proceed with secure access
  } else {
    print('Failed: ${result['message']}');
    // Offer retry or alternate auth
  }
});
Cordova
document.addEventListener('onIDVServerBiometricAuthenticationResult', function(result) {
  if (result.status === 'SUCCESS') {
    // Authentication success
  } else {
    console.error('Auth failed:', result.message);
    // Handle retry or fallback
  }
});
Native Android
@Override
public void onIDVServerBiometricAuthenticationResult(JSONObject result) {
    String status = result.optString("status");
    if ("SUCCESS".equals(status)) {
        // Continue secure flow
    } else {
        Log.e("BiometricAuth", "Failed: " + result.optString("message"));
        // Show error UI
    }
}
Native iOS (Objective-C)
- (void)onIDVServerBiometricAuthenticationResult:(NSDictionary *)result {
    NSString *status = result[@"status"];
    if ([status isEqualToString:@"SUCCESS"]) {
        // Proceed to secured screen
    } else {
        NSLog(@"Authentication failed: %@", result[@"message"]);
        // Provide retry or fallback option
    }
}