Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ramuta opened this issue Jul 9, 2021 · 13 comments
Open

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

ramuta opened this issue Jul 9, 2021 · 13 comments

Comments

@ramuta
Copy link
Contributor

ramuta commented Jul 9, 2021

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
Copy link
Member

LonelyCpp commented Jul 9, 2021

definitely not!

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

@ramuta
Copy link
Contributor Author

ramuta commented Jul 9, 2021

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
Copy link
Contributor Author

ramuta commented Jul 9, 2021

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
Copy link
Member

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
Copy link
Contributor Author

ramuta commented Jul 9, 2021

The device is OnePlus 3 (A3003) with Android 9

@ramuta
Copy link
Contributor Author

ramuta commented Jul 9, 2021

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
Copy link

fellenabmb commented Jul 26, 2021

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
Copy link
Member

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
Copy link
Member

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
Copy link

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
Copy link

fellenabmb commented Jul 27, 2021

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
Copy link
Member

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
Copy link

dibenduCfcs commented Oct 7, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants