xamarin-fingerprint icon indicating copy to clipboard operation
xamarin-fingerprint copied to clipboard

"Try Face ID Again" does nothing on click.

Open belmonmi opened this issue 1 year ago • 1 comments

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

belmonmi avatar Aug 08 '22 20:08 belmonmi

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.

smsissuechecker avatar Aug 08 '22 20:08 smsissuechecker