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

Added fallback mechanism for android #610

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gokulkulkarni1987
Copy link

authenticationType was not being respected on Android

  • After going through the following link found out that there is a scope for adding support for fallback on Android API 30 & above.
  • Updated the Example App to support the same.

@gokulkulkarni1987
Copy link
Author

Guys this is my first PR,

  1. it is showing as merging is blocked
  2. Some checks haven't completed yet.

I am not sure if I have to do anything more from my side.

If I run lint and flow locally I do not get any errors,

Screenshot 2023-09-05 at 1 24 17 AM

@saadi-ninjasCode
Copy link

saadi-ninjasCode commented Sep 22, 2023

@gokulkulkarni1987 , I tried your solution but I got the following error
{"Authentication error is => ": {"error": [Error: Negative text must not be set if device credential authentication is allowed.]}}

I tested on two Android version 11 & 12

Screenshot 2023-09-22 at 3 20 40 PM

@saadi-ninjasCode
Copy link

@gokulkulkarni1987 , I tried your solution but I got the following error {"Authentication error is => ": {"error": [Error: Negative text must not be set if device credential authentication is allowed.]}}

I tested on two Android version 11 & 12

Screenshot 2023-09-22 at 3 20 40 PM

I fixed this issue by adding authenticationPrompt: { cancel: '' } . Furthermore, it should be handled internally in KeychainModule.java at line # 622 .
Screenshot 2023-09-22 at 3 48 19 PM

ERROR => When I add the above line, I get the following error on devices ANDROID_VERSION < 11
{"Authentication error is => ": {"error": [Error: Negative text must be set and non-empty.]}}

Expected Behavior:
It should be working on ANDROID_VERSION < 11. I don't have depth knowledge of ANDROID, But I figured out that if make some changes at line # 622 (Code of block is mentioned below). It should be resolved.

if (null != promptInfoOptionsMap && promptInfoOptionsMap.hasKey(AuthPromptOptions.CANCEL)) { String promptInfoNegativeButton = promptInfoOptionsMap.getString(AuthPromptOptions.CANCEL); promptInfoBuilder.setNegativeButtonText(promptInfoNegativeButton); }

@gokulkulkarni1987
Copy link
Author

@saadi-ninjasCode We get Negative text must be set and non-empty when just BIOMETRIC_STRONG is enabled.
The fix I have added is for supporting both BIOMETRIC_STRONG & DEVICE_CREDENTIAL, which is available only after Android API 30, for DEVICE_CREDENTIALS to work we must not set cancel text (thats internal of Android).
Below is the screenshot from class BiometricPrompt

Screenshot 2023-09-22 at 8 28 20 PM

if you see the lines from KeychainModule,

Screenshot 2023-09-22 at 8 36 15 PM

Negative button text setting or not is already handled, so on react-native side if we just check the android version and accordingly pass or not would be better idea.

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

Successfully merging this pull request may close these issues.

2 participants