smstuebe / xamarin-fingerprint

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

"Try Face ID Again" does nothing on click. #228

Open belmonmi opened 1 year ago

belmonmi commented 1 year ago

The AuthenticateAsync() method doesn't return control to client code unless authentication completed successfully or user clicked "Cancel". Clicking on "Try Face ID Again" does nothing.

Steps to reproduce

  1. Make sure CrossFingerprint is registered with app builder DI Services: inBuilder.Services.AddSingleton(typeof(IFingerprint), CrossFingerprint.Current);

  2. Add button to a page or any other way to call AuthenticateAsync() method, for example: `

private async Task AuthenticateWithBiometrics() { try {

  AuthenticationRequestConfiguration tmpConf = new AuthenticationRequestConfiguration(
    "Authentication",
    "Authenticate access to application"
    );

  tmpConf.AllowAlternativeAuthentication = true;

  IFingerprint tmpFingerprint = MauiProgram.Services.GetService<IFingerprint>();

  // on the next line: execution continues only when authentication completed successfully or user clicked on "Cancel"
  FingerprintAuthenticationResult tmpAuthResult = await tmpFingerprint!.AuthenticateAsync(tmpConf, CancellationToken.None);

  this.m_Logger?.LogInformation($"FingerprintAuthenticationResult - Authenticated: {tmpAuthResult.Authenticated} Status:{tmpAuthResult.Status}");

        return tmpAuthResult.Authenticated;
}
catch (Exception ex)
{
  this.m_Logger?.LogError($"AuthenticateWithBiometrics() failed ({ex.GetType().Name}): {ex.Message}");
  return false;
}

}

`

Expected behavior

AuthenticateAsync() returns FingerprintAuthenticationResult with Authenticated property false and Status with value "FingerprintAuthenticationResultStatus.Failed" . This is will allow to implement appropriate handling of biometrics failure.

Actual behavior

The AuthenticateAsync() doesn't returns unless authentication is success or user clicked on "Cancel". Clicking on "Try Face ID Again" does nothing.

Configuration

Version of the Plugin: 3.0.0-beta.1

Platform: iOS 15.4

Device: iPhone 12 Pro

smsissuechecker commented 1 year ago

Hi @belmonmi,

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.