Demo app for testing the cordova-plugin-biometric-auth, which allows to authenticate users with biometrics or fallback PIN, pattern or password. Uses AndroidX and supports Android 5.0 onwards. Source code available in GitHub.
Android screenshots
Browser screenshots
Methods
isAvailable
Checks if the user can authenticate with either biometrics, fallback PIN, pattern or password. Biometric requires at least one biometric sensor to be present, enrolled, and available on the device.
Android quirks
Not all combinations of authenticator types are supported prior to Android 11 (API 30). Specifically, DEVICE_CREDENTIAL
alone is unsupported prior to API 30, and BIOMETRIC_STRONG | DEVICE_CREDENTIAL
is unsupported on API 28-29.
Browser quirks
This filler platform always returns BIOMETRIC_SUCCESS and does not check nor use a real biometric device.
authenticate
Shows the biometric prompt or the fallback device credential dialog for authentication.
Android quirks
Not all combinations of authenticator types are supported prior to Android 11 (API 30). Specifically, DEVICE_CREDENTIAL
alone is unsupported prior to API 30, and BIOMETRIC_STRONG | DEVICE_CREDENTIAL
is unsupported on API 28-29.
Browser quirks
Browser platforms shows a dialog to manually select either of these results and does not perform any actual biometric check:
- AUTHENTICATION_FAILED
- BIOMETRIC_DISMISSED
- BIOMETRIC_SUCCESS
Remarks
Both isAvailable and authenticate methods will use the selected authenticators value from the drop-down list with one of these options:
- AUTO (0): Calls the deprecated BiometricManager.canAuthenticate() method without arguments to check if the user can authenticate with biometrics. If the result is false, it checks for KeguardManager.isKeyguardSecure().
- KEYGUARD_MANAGER (1): Calls the KeguardManager.isKeyguardSecure() method that is available since Android 5.0.
- BIOMETRIC_STRONG (15)
- BIOMETRIC_WEAK (255)
- DEVICE_CREDENTIAL (32768)
- BIOMETRIC_STRONG+DEVICE_CREDENTIAL (32783)
- BIOMETRIC_WEAK+DEVICE_CREDENTIAL (33023)
The option AUTO (0) can be used to check for biometrics + device credentials as fallback with a single and reliable method. Recommended to check if you can use the PIN, pattern or password authentication when no biometrics are enrolled or supported. Android 5 supported.
The authenticator KEYGUARD_MANAGER (1) is a plugin-created value to directly check if you can use PIN, pattern, password or biometrics if enrolled. Can be used starting Android 5.
Download demo app
- Download debug APK v1.0.1 (minSdkVersion 21)
- Download www source code
Feedback
Use the comments section here for demo app-related issues, and the GitHub issues tracker for plugin-related ones.
More plugin demo apps
Check out the following Cordova plugin demo apps ready for download on your device. The source code is included for compiling to any platform.
Disclaimer
The content in this post is for general information purposes only. The information is provided by the author and/or external sources and while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the post for any purpose. Some of the content and images used in this post may be copyrighted by their respective owners. The use of such materials is intended to be for educational and informational purposes only, and is not intended to infringe on the copyrights of any individuals or entities. If you believe that any content or images used here violate your copyright, please contact us and we will take appropriate measures to remove or attribute the material in question.