react-native-keychain icon indicating copy to clipboard operation
react-native-keychain copied to clipboard

getSupportedBiometryType returns null if user denied access

Open mvayngrib opened this issue 6 years ago • 12 comments

currently if the user denies access to Face ID, getSupportedBiometryType returns null

it would be useful to know that the user has denied access, to be able to redirect the user to app settings to fix the situation (in case the user made a mistake or changed their mind)

i understand this wouldn't be backwards compatible, so maybe we can add a second method that returns a more verbose response than getSupportedBiometryType?

mvayngrib avatar Jul 26 '19 14:07 mvayngrib

Came here to mention the same issue. There isn't a reliable way to determine whether the device supports FaceID if it's been disabled at the OS app settings level. This could be an intentional security feature on iOS.

petekp avatar Aug 22 '19 19:08 petekp

@mvayngrib I submitted a PR that I believe should fix this issue (it did for me). Try it out: https://github.com/oblador/react-native-keychain/pull/240

petekp avatar Aug 22 '19 21:08 petekp

I am using a custom flag to store this info to async storage which is based on the response of the initial prompt for biometric access as a workaround.

dsouzaedison avatar Sep 06 '19 04:09 dsouzaedison

I am using a custom flag to store this info to async storage which is based on the response of the initial prompt for biometric access as a workaround.

This sounds like it would solve my use case @dsouzaedison - what is the error response you can expect to get back from the initial prompt that indicates the user declined?

allisonkbarr avatar Jan 07 '20 00:01 allisonkbarr

@allisonkbarr This issue should be fixed (see https://github.com/oblador/react-native-keychain/pull/240) meaning getSupportedBiometryType should now return the device's biometry type regardless of the permission state.

petekp avatar Jan 07 '20 02:01 petekp

@allisonkbarr This issue should be fixed (see #240) meaning getSupportedBiometryType should now return the device's biometry type regardless of the permission state.

Yes I'm actually looking for the opposite - I want to know that the user declined the permission so that I do not make it appear to the user that they can still enable biometric login from the app (once they have declined permission, additional requests will fail).

allisonkbarr avatar Jan 07 '20 03:01 allisonkbarr

@allisonkbarr You may need a separate lib to get that information: react-native-permissions can provide this info via the check method.

petekp avatar Jan 07 '20 04:01 petekp

@petekp Do you know how to check whether the user has enrolled at least one finger for Touch ID? The library you mention doesn't provide that info, as it's technically not a permission (unlike Face ID), and with #240 merged we can no longer easily find out if our app can assume Touch ID to be available in practice…

richeterre avatar Jan 14 '20 14:01 richeterre

@richeterre Have you tried using canImplyAuthentication? We use this with Keychain.ACCESS_CONTROL.BIOMETRY_CURRENT_SET to determine if the enrolled fingers have changed. If I remember correctly this should also return false if no fingers have been enrolled.

petekp avatar Jan 14 '20 17:01 petekp

@petekp Works like a charm, thanks for the tip! 💯

richeterre avatar Jan 16 '20 09:01 richeterre

@petekp @oblador stil this issue exists, getSupportedBiometryType returns null if user denied access When i denied the face id permission, getSupportedBiometryType return null tried ios 17.2 +

any help would appreciated.

SuganyaEkambaram avatar May 08 '24 10:05 SuganyaEkambaram

Hi @oblador @vonovak, Facing same issue in iOS 17.5+ is there any workaround? Anyways thanks a lot for creating this library :)

vikassharma96 avatar Jun 11 '24 17:06 vikassharma96