f-miyu / Plugin.FirebaseAuth

MIT License
61 stars 26 forks source link

Plugin.FirebaseAuth.FirebaseAuthException: An error occurred when accessing the keychain #30

Open robertmaxted opened 3 years ago

robertmaxted commented 3 years ago

I'm using the latest stable package of Plugin.FirebaseAuth (4.1.0). But when I try to call the SignInWithEmailAndPasswordAsync(email, password). I get an exception?

Method:

`public async Task SignIn(string email, string password) { try {

    var result = await CrossFirebaseAuth.Current.Instance.SignInWithEmailAndPasswordAsync(email, password);
    var token = await result.User.GetIdTokenAsync(true);
    Preferences.Set("MyFirebaseRefreshToken", token);
    AccountManager.CurrentUserId = result.User.Uid;
    return true;
}
catch (FirebaseAuthException ex)
{
    Console.WriteLine(ex.Reason);
    await App.Current.MainPage.DisplayAlert($"Alert", (ex.Reason.ToString()), "OK");
    return false;
}

}`

Screenshot 2021-04-13 at 20 56 12

robertmaxted commented 3 years ago

@f-miyu @f-matsushima Please advise asap, kind regards.

f-miyu commented 3 years ago

Do you run in the simulator? Please run on a real device because it doesn't work well in the simulator.

robertmaxted commented 3 years ago

Ahh I see I'll try it on a device and let you know, thanks @f-miyu , is there a reason it doesn't work correctly on the simulator?

f-miyu commented 3 years ago

I don't know mush, but the provisioning seems to be the reason for the error. It may work in the simulator, if you set Custom Entitlements in iOS Bundle Signing of Project Options.

robertmaxted commented 3 years ago

Since adding a provisioning profile to the project it works as expected. Thanks again @f-miyu :)