Skip to main content

Biometric Authentication

Introduction


Biometric Authentication is a security process that leverages the unique biological characteristics of individuals to verify their identities. In native applications, it is often used to provide a seamless, secure, and efficient user experience.

LambdaTest now supports Biometric Authentication for real devices (iOS and android). This new feature allows you to test your application's biometric authentication functionality more accurately and ensures your app provides an optimal user experience across a range of devices and platforms.

info

OS Version: Biometric authentication is supported only on Android devices with OS version 11 or above, and on iOS devices with OS version 13 or above.

Biometric Authentication APIs supported

Below given is the list of Biometric Authentication APIs which are supported. Please ensure that your app uses these APIs only to enable Biometric Authentication.

OSDevicesSupported APIs
AndroidAndroid 11 and higherBiometricPrompt class's authenticate method from the AndroidX Biometric library is used for Biometric authentication on Android devices. For details, please check AndroidX Biometric Documentation.
Android's Native BiometricPrompt API is part of the Android platform and is used for Biometric authentication on Android devices. For details, please check Android Developers Documentation.
iOSLAContext: The LAContext class is used to interact with the local authentication framework.
evaluatePolicy: The evaluatePolicy(_:localizedReason:reply:) method of LAContext used to actually perform the biometric authentication, such as verifying a user's face or fingerprint.
canEvaluatePolicy: The canEvaluatePolicy(_:error:) method of LAContext that checks whether a specific biometric authentication policy can be evaluated on the device.

Note: The OS versions and APIs mentioned above are subject to change as per the latest OS updates and best practices recommended by Android and iOS.

Biometric Authentication in Real Device App Testing


This feature allows you to simulate successful or failed biometric authentication during real-time app testing. Follow the steps below to enable biometric authentication in your testing session:

  1. Go to App Testing under the Real Devices section given in the side bar of your LambdaTest console.
  2. On the App testing page upload your application.
    tip

    After uploading your application, please wait atleast for 1-2 minutes for the application file patching process to complete.

  3. Hover over the app for which you wish to enable Biometric Authentication and click on the Settings icon. You'll find a toggle for Biometric Authentication; switch it on, as depicted in the image below. After toggling the switch, remember to click on Save changes. Then, proceed by clicking on Start to initiate the session and run your app on the selected device.
Image
  1. Once your session starts and biometric authentication is enabled for the app, use Lambdatest's Biometric Authentication pop-up shown below to interact with any instance where biometric authentication is invoked.
Image

Biometric Authentication in App Automation


Using desired Capabilities

To enable biometric authentication feature in your automation script, set the capability enableBiometricsAuthentication to true.

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("build","Java TestNG Android");
capabilities.setCapability("name",platform+" "+device+" "+version);
capabilities.setCapability("deviceName", device);
capabilities.setCapability("platformVersion",version);
capabilities.setCapability("platformName", platform);
capabilities.setCapability("isRealMobile", true);
capabilities.setCapability("app", "APP_URL"); //Enter your app (.apk) url
capabilities.setCapability("deviceOrientation", "PORTRAIT");
capabilities.setCapability("console", true);
capabilities.setCapability("network", false);
capabilities.setCapability("visual", true);
capabilities.setCapability("devicelog", true);
capabilities.setcapability("enableBiometricsAuthentication",true)

Using Lambda-Hook

To implement pass or fail conditions for biometric authentication in your automation script, you have to use our Lambda-hook mentioned below:

driver.execute_script("lambda-biometric-injection=fail")

TYPEKEYDATA TYPEVALUES
capability (for both iOS & android)enableBiometricsAuthenticationbooleantrue
OR
false
lambda-hooklambda-biometric-injectionlambda-biometric-injection=fail
OR
lambda-biometric-injection=pass
info

To use the web hook, passing biometric or enableBiometricsAuthentication capability is mandatory.


Important Notes

  1. If you plan to use the Uninstall Lambda Hook, and then the Install Lambda Hook for the same application, biometric authentication can be used afterwards only via the lambda-hook. In this case, the initial capability won't be applicable anymore.
  2. Biometric authentication will work for all the applications that were uploaded after 23rd June 2023.