Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication on view appearing #3

Open
gaglia opened this issue Jul 25, 2024 · 2 comments
Open

Authentication on view appearing #3

gaglia opened this issue Jul 25, 2024 · 2 comments

Comments

@gaglia
Copy link

gaglia commented Jul 25, 2024

Hi,

I'm trying to use the plugin to enable biometric authorization on the login page of my application.

So I would like the finger recognition PopUp to appear immediately when opening my Login view.

I tried to simulate this starting from your example by simply adding the AuthenticateAsync call on the OnAppearing event of the MainPage:

`protected override async void OnAppearing()
{
base.OnAppearing();

var type = await BiometricAuthentication.Current.GetAuthenticationTypeAsync();
AuthenticationTypeLabel.Text = $"Auth Type: {type:G}";

await AuthenticateAsync(reason: "Prove you have fingers!");
}`

Can you help me understand the problem?
Thanks a lot

Steps to reproduce

  1. Run sample application on device or emulator

Expected behavior

Open biometric authentication when opening the view

Actual behavior

Authentication fails without displaying the PopUp to the user to recognize the fingerprint

Configuration

Version of the Package: 1.0.1

Platform: Android 13

Device: Nokia G50

@HavenDV
Copy link
Collaborator

HavenDV commented Jul 25, 2024

Can you send an exception?

protected override async void OnAppearing()
{
    base.OnAppearing();
    
    try
    {
        var type = await BiometricAuthentication.Current.GetAuthenticationTypeAsync();
        AuthenticationTypeLabel.Text = $"Auth Type: {type:G}";
        
        await AuthenticateAsync(reason: "Prove you have fingers!");
    }
    catch(Exception exception)
    {
         // Set break point here
    }
}

@gaglia
Copy link
Author

gaglia commented Jul 25, 2024

Hi,

I don't get any exceptions, BiometricAuthentication.Current.AuthenticateAsync instead exits with error status "UnknownError" with this message:
FragmentManager is already executing transactions

Doing some other tests it seems that inserting a delay of 2 seconds in the OnAppearing event opens the biometric recognition PopUp correctly.

 protected override async void OnAppearing()
 {
     base.OnAppearing();

     await Task.Delay(2000);

     try
     {
         var type = await BiometricAuthentication.Current.GetAuthenticationTypeAsync();
         AuthenticationTypeLabel.Text = $"Auth Type: {type:G}";

         await AuthenticateAsync(reason: "Prove you have fingers!");
     }
     catch (Exception exception)
     {
         var x = exception.ToString();            
     }
    
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants