smstuebe / xamarin-fingerprint

Xamarin and MvvMCross plugin for authenticate a user via fingerprint sensor
Microsoft Public License
490 stars 115 forks source link

Available returned & Type = Fingerprint even if no fingerprints or face registered #178

Open LagniappeRob opened 4 years ago

LagniappeRob commented 4 years ago

Steps to reproduce

  1. No Fingerprints or Face registered on device, A pin has been set.

  2. CrossFingerprint.Current.IsAvailableAsync(true) returns true

  3. CrossFingerprint.Current.GetAvailabilityAsync(true) returns Available

  4. CrossFingerprint.Current.GetAuthenticationTypeAsync() returns Fingerprint

  5. Call to AuthenticateAsync returns ErrorMessage = NoFingerprint

Expected behavior

IsAvailable should be true and GetAvailability should be Available since a Pin has been set. The GetAuthenticationType should return Pin. Call to AuthenticateAsync should use Pin

Actual behavior

Fingerprint is returned by GetAuthenticationType. Call AuthenticateAsync immediately fails with error.

Crashlog

If something causes an exception paste full stack trace + Exception here

Configuration

Version of the Plugin: e.g. 1.0.0 / 1.0.1-alpha3 2.1.1

Platform: e.g. iOS 10.1 / Android 4.4 / ... (including version!!! e.g. Android 5.1 / i0S 10) Android 9

Device: e.g. HTC Sensation /i Phone 7 ... Samsung A50

smsissuechecker commented 4 years ago

Hi @LagniappeRob,

I'm the friendly issue checker. Thanks for using the issue template :star2: I appreciate it very much. I'm sure, the maintainers of this repository will answer, soon.

vladPanasiuk commented 3 years ago

I have the same issue on Android 10, any news on this issue ?

smstuebe commented 3 years ago

@LagniappeRob @vladPanasiuk That's how it works. If you allow alternative authentication by passing true, you ofc. get available back.

https://github.com/smstuebe/xamarin-fingerprint/blob/master/src/Plugin.Fingerprint/Abstractions/IFingerprint.cs#L23

if you don't want to allow alternative authentication (pin, pattern, ...), don't pass true. And if you want to allow alternative authentication you have to call AuthenticateAsync also with allowalternativeauthentication set to true.

vladPanasiuk commented 3 years ago

@LagniappeRob @vladPanasiuk That's how it works. If you allow alternative authentication by passing true, you ofc. get available back.

https://github.com/smstuebe/xamarin-fingerprint/blob/master/src/Plugin.Fingerprint/Abstractions/IFingerprint.cs#L23

if you don't want to allow alternative authentication (pin, pattern, ...), don't pass true. And if you want to allow alternative authentication you have to call AuthenticateAsync also with allowalternativeauthentication set to true.

I understand that. I do not allow alternative authentication. But the CrossFingerprint.Current.IsAvailableAsync (false) returns true while the phone does not support any type of biometric authentication. And the CrossFingerprint.Current.GetAuthenticationTypeAsync() returns Fingerprint. This is on a Samsung Galaxy A10, Android 10

klogeaage commented 3 years ago

I have the same issue on a Samsung T510 tablet running Android 10 where the IsAvailableAsync(true) returns true, but the actual authentication with AuthenticateAsync(conf) with AllowAlternativeAuthentication set to true returns false and anErrorMessage = "Biometric hardware unavailable". So now I test for this error message, which is a workaround but not so pretty.

rodrigojuarez commented 3 years ago

@klogeaage but you can't know beforehand if the user is enrolled, right?

klogeaage commented 3 years ago

@rodrigojuarez not sure what you mean by 'enrolled'?

rodrigojuarez commented 3 years ago

Is the term used on iOS to indicate that the user has opted in from the operating system's settings to use biometrics

klogeaage commented 3 years ago

My comments specifically mentioned an Android device, which is configured to require a pin whenever you unlock the screen. Apart from that, it doesn't support any biometric devices, which is also reflected in the error message you get when attempting to do an AuthenticateAsync() call. It is therefore inconsistent that the call to IsAvailableAsync(true) returns true, which I believe this issue is about.