[RESOLVED] Trouble Using/Implementing Supported Authentication Types



I’m working on detecting which type of biometric authentication methods are supported on the device that the application is running on.

I’ve fully implemented, tested, and confirmed that the authentication method flow works perfectly. But now I want to include a button that will re-prompt the user for authentication if their initial fingerprint/face id scan fails. But I want to display a button with an appropriate image based on which auth type the user has, which has led me to the following feature: LocalAuthentication.supportedAuthenticationTypesAsync();

The only problem I have found is that this is returning an array.

Here is a use case example:

let biometricType = await LocalAuthentication.supportedAuthenticationTypesAsync();
console.log("Biometric Types: " + biometricType[0] + ' ' + biometricType[1]);
console.log("Biometric Types: " + biometricType);

And what it returns is this:

[11:55:54] Biometric Types: 2 undefined
[11:55:54] Biometric Types: 2

Is this an issue with the implementation of the feature or am I doing something wrong here?



Hey @qchester,

You are implementing it correctly and it’s working as expected. If you did the following:

let types = await LocalAuthentication.supportedAuthenticationTypesAsync()

and the value of types was [2] that means only facial recognition is supported. [1,2] would indicate both fingerprint and facial support and [1] indicates just fingerprint support.

I’m going to add something to clarify this in our docs. Thanks for bringing this to light.



1 Like

Ah, interesting. Thanks for the reply!

I’m guessing it would be uncommon for [1,2] to be the end result, correct? Given that result, would it be best to prompt for Touch, [1] to be safe?



Yeah, it would be uncommon but we’ve implemented it this way so that if Apple decides to re-introduce fingerprint alongside facial recog. in new models or some Android device supports both in the future. I suppose that wouldn’t be a bad idea.


Makes sense, good move on your end future-proofing :slightly_smiling_face:

In case someone needs it in the future, I just have it set up to fallback to touch if the touch sensor is available.

let biometricType = await LocalAuthentication.supportedAuthenticationTypesAsync();

if (biometricType == 2) {
    // Face
    this.setState({biometricType: "FACE"});
} else {
    // Touch
    this.setState({biometricType: "TOUCH"});
closed #6

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.