step-up-labs / firebase-database-dotnet

C# library for Firebase Realtime Database.
MIT License
668 stars 168 forks source link

Auth Errors #278

Closed eduardoagr closed 2 years ago

eduardoagr commented 2 years ago

Sometimes when I run the app, I get this

Firebase.Auth.FirebaseAuthException: 'Exception occured while authenticating.
Url: https://securetoken.googleapis.com/v1/token?key={0}
Request Data: {"grant_type":"refresh_token", "refresh_token":"AIwUaOkVr1FHyj9vym0ZTJjzMvWShDXlUokyq5zRStTeeQU5F5Ep1Pg9m1T-23qRN4I_BELCq-1CED4iM9zl5NdMx-pWjh8bJwP9AtVH7d70A7WdKTtdS7xHyNtAk2gDaHyribW97_RHCYMYMAPCx-8U2DhixqSjc4kxjN2EteikYawnJtrQeT6ecCGgy8425PKpnbzHxBDr"}
Response: N/A
Reason: Undefined'

these are my methods for register and login

` public async Task RegisterAsync(User users) {

        try {
            UserDialogs.Instance.ShowLoading(AppResources.Loading);
            var auth = await AuthProvider.CreateUserWithEmailAndPasswordAsync(users.Email, users.Password);
            await PopupNavigation.Instance.PopAsync(true);
            await App.Current.MainPage.DisplayAlert(AppResources.NewUser, AppResources.UserInserted, "OK");
        } catch (FirebaseAuthException ex) {
            Firebasemessages.GetMessages(ex);
        }
        UserDialogs.Instance.HideLoading();
    }

    public async Task LoginAsync(User users) {

        try {
            UserDialogs.Instance.ShowLoading(AppResources.Loading);
            var auth = await AuthProvider.SignInWithEmailAndPasswordAsync(users.Email, users.Password);
            var content = await auth.GetFreshAuthAsync();
            var serializedcontnet = JsonConvert.SerializeObject(content);
            Preferences.Set(AppConstant.FirebaseToken, auth.FirebaseToken);
            Preferences.Set(AppConstant.UserID, auth.User.LocalId);
            Preferences.Set(AppConstant.FirebaseRefreshToken, serializedcontnet);
            UserDialogs.Instance.HideLoading();
            Application.Current.MainPage = new NavigationPage(new NotebooksPage());
        } catch (FirebaseAuthException ex) {
            Firebasemessages.GetMessages(ex);
        }
        UserDialogs.Instance.HideLoading();
    }`
eduardoagr commented 2 years ago

Newtonsoft.Json.JsonReaderException: 'Error parsing NaN value. Path '', line 1, position 1.'

eduardoagr commented 2 years ago

Firebase.Auth.FirebaseAuthException: Exception occured while authenticating. Url: https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupNewUser?key={0} Request Data: {"email":"a@a.com","password":"123456","returnSecureToken":true} Response: N/A Reason: Undefined ---> Java.Net.UnknownHostException: Unable to resolve host "www.googleapis.com": No address associated with hostname ---> Java.Lang.RuntimeException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)