Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Face Id authentication in android (Ionic)

I am developing a Hybrid application for which once the user enters the username and password initially after successful login the user is prompted with a dialog box asking whether to enable FaceID unlocking or not. If the User presses Yes next time the user will directly will be asked to scan the face instead of username and password. In iOS i am successful in doing this.

But how to implement the same in the Android using Cordova. Is there any specific plugin to enable it. If it is there please help me with the plugin or If not please specify the reason.

like image 353
HARITHA UPPARA Avatar asked May 15 '18 09:05

HARITHA UPPARA


2 Answers

It is not possible to achieve the same capabilities of the Face Id to unlock an app on Android, so it wouldn't be possible even using Android native app.

Android uses the keymanager to achieve unlocking capabilities on apps, using primitive authentication methods. That allows you to use pin code or fingerprint authentication. At this time, face recognition is not available yet.

Apple and Face ID can allow this because Face ID is a primitive security method for the iPhone X, as the data used to unlock the device is kept in the Secure Enclave, in the same way that Touch ID data is.

My guess is that Android will follow Apple's steps and implement a solution like Face ID for authentication in one of Android's next versions (not on Android P), but until then, if you really must have face recognition to unlock your app, you can try using 3rd-party libraries, but none will fully achieve the Face Id native capabilitues

Sources:

  • Related stackoverflow article
  • Android Keyguard docs
  • Third party image recognition cordova plugin
  • Face ID on Android adoption
like image 99
Ruben Miquelino Avatar answered Sep 21 '22 23:09

Ruben Miquelino


I am using the plugin called cordova-plugin-keychain-touch-id and it works both for face and touch.

Be aware that some Android phone both have face and touch, and if both are enabled, it returns OKin stead of touch or face. Also with Android's OREO OS made it possible for older Android phone to login with face biometrics using something called "Trusted Face".

I am still having some issues with face login activation on the phones where both are enabled and with the trusted face, but maybe you (or someone else) have a solution for this :)

Good luck!

like image 29
Lirianna Avatar answered Sep 19 '22 23:09

Lirianna