react-native-simple-biometrics icon indicating copy to clipboard operation
react-native-simple-biometrics copied to clipboard

Entering PIN number doesn't work - is this intended?

Open ramuta opened this issue 4 years ago • 13 comments

When a fingerprint prompt shows up and user chooses to enter a PIN number instead of a fingerprint, nothing happens (even if the PIN is correct). The requestBioAuth() function does not return anything, not even false...

Is this intended behaviour?

ramuta avatar Jul 09 '21 17:07 ramuta

definitely not!

requestBioAuth() rejects the promise if authentication fails, so try adding a .catch() block and see if it's throwing some error.

LonelyCpp avatar Jul 09 '21 17:07 LonelyCpp

I do have a try/catch block, exactly as it is in the README:

try {
    await RNBiometrics.requestBioAuth("prompt-title", "prompt-message");
    // stuff to do when authenticated
    // ...
  } catch (error) {
    // stuff to do when auth failed
    // ...
  }

But no error shows up when the PIN is entered... 🤔

ramuta avatar Jul 09 '21 17:07 ramuta

When I click the "Use Password" button, a new PIN screen shows up (it takes up the whole screen). I have a feeling that this in some way "breaks" the connection with my app and does not return anything back to it. It may be due to the specific Android flavour that I use...

I'll need to try this out on some more Android devices.

ramuta avatar Jul 09 '21 17:07 ramuta

it will be helpful if you can post some details about the device, android version, etc for me to try and reproduce. It works alright on the android emulator + some devices that we have tested on.

LonelyCpp avatar Jul 09 '21 17:07 LonelyCpp

The device is OnePlus 3 (A3003) with Android 9

ramuta avatar Jul 09 '21 17:07 ramuta

I've tested the PIN login in the simulator and it works. So the problem is not in my app code, but in my phone, I guess...

ramuta avatar Jul 09 '21 18:07 ramuta

I've tested the PIN login in the simulator and it works. So the problem is not in my app code, but in my phone, I guess...

I second this, it's also happening on a Galaxy S7. Physical device, of course. At this point I do think it's a bug/incompatibility with custom UIs since it seems to be working a-ok on plain android devices, such as simulators.

fellenabmb avatar Jul 26 '21 19:07 fellenabmb

At this point I do think it's a bug/incompatibility with custom UIs

this is most likely the case.

I've released an alpha version (1.5.0-alpha.0) with an alpha version of the biometrics jetpack library. Let me know if it works for you guys

LonelyCpp avatar Jul 27 '21 15:07 LonelyCpp

found a bug report on google's issue tracker - https://issuetracker.google.com/issues/142409713

can you guys try toggling 'Don't keep activities' in developer settings and try the biometric prompt?

LonelyCpp avatar Jul 27 '21 15:07 LonelyCpp

At this point I do think it's a bug/incompatibility with custom UIs

this is most likely the case.

I've released an alpha version (1.5.0-alpha.0) with an alpha version of the biometrics jetpack library. Let me know if it works for you guys

Great, thanks for that!. I'll test it and let you guys know shortly. I can confirm that this seems to happen with phones with custom UI's, I got my hands on a Nexus with pure android and it seems to be working just fine.

fellenabmb avatar Jul 27 '21 16:07 fellenabmb

Quick update: I tested the alpha and had no luck, sadly. Still the same behaviour. Toggling the 'don't keep activities' option makes the app reset itself, basically, after entering the password.

fellenabmb avatar Jul 27 '21 19:07 fellenabmb

this issue is most likely fixed with the new alpha. Its mentioned in the changelog here : https://developer.android.com/jetpack/androidx/releases/biometric#1.2.0-alpha04

LonelyCpp avatar Jan 03 '22 19:01 LonelyCpp

I got one solution for getting Device Pin/Password in Android after 2 - 3 times wrong Fingerprint. Please follow above steps to achieve this.

  1. Fork this original library.
  2. Clone it
  3. Go to folder android-->src --> main --> java -->com --> rnbiometrics --> ReactNativeBiometrics.java
  4. Replace .setUserAuthenticationRequired(true) with .setUserAuthenticationRequired(false)
  5. Go to folder android-->src --> main -->AndroidManifest.xml
  6. add android:requiredFeature="false" in "android:name="android.permission.USE_BIOMETRIC" permission
  7. Push your code in your git repo.
  8. and install this [https://github.com/{githubUser}/react-native-biometrics] in your required project.

dibenduCfcs avatar Oct 07 '23 16:10 dibenduCfcs