smallcase / react-native-simple-biometrics

simple interface to verify user authenticity
https://www.npmjs.com/package/react-native-simple-biometrics
MIT License
183 stars 16 forks source link

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

Open ramuta opened 3 years ago

ramuta commented 3 years ago

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?

LonelyCpp commented 3 years ago

definitely not!

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

ramuta commented 3 years ago

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 commented 3 years ago

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.

LonelyCpp commented 3 years ago

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.

ramuta commented 3 years ago

The device is OnePlus 3 (A3003) with Android 9

ramuta commented 3 years ago

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...

fellenabmb commented 3 years ago

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.

LonelyCpp commented 3 years ago

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 commented 3 years ago

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?

fellenabmb commented 3 years ago

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 commented 3 years ago

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.

LonelyCpp commented 2 years ago

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

dibenduCfcs commented 1 year ago

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.