1
votes

I've set up the most basic implementation of firebase auth login with email and password.

firebase.auth().signInWithEmailAndPassword(email, password).then(() => {

    console.log('Logged in')
    window.location.href = "./home.html"

}).catch(function (error) {

    console.log(error)

});

For some reason, on iOS, the login process sometimes gets stuck waiting for the promise of signInWithEmailAndPassword() to resolve. I don't get any error message.

The only way to re-enable the login mechanism is to clear the browser cache.

Is this a known problem? I've been experiencing this problem for my last two apps over the last year.

Edit: After further trial and error I found out that the problem usually happens after being logged in, letting the iPhone go to sleep, waking it back up, and then logging out. Then the same problem also happens for the signOut() function.

2
Please edit the question to show the code that isn't working the way you expect, and explain in more detail. - Doug Stevenson
If you think there is a bug, and you're able to reproduce it with specific steps, you should file a bug report with Firebase support. support.google.com/firebase/contact/support - Doug Stevenson
Ok Doug, will do. - Max

2 Answers

0
votes

Turns out the problem had to do with the domain not being whitelisted in my project settings. The reason why I didn't pay attention to the console alert about oAuth was that it did work most of the times, even with it showing. So I thought it didn't have any effect on it.

The answer was suggested in this thread

0
votes

I was having the same issue, but it was even more consistent when I moved to version 9 of the firebase sdk and my app was running in an Ionic-Capacitor native app on iOS. The solution was to add "localhost" to Firebase > Authentication > Sign-in method > Authorize domains. Then I needed to use intializeAuth() when running in hybrid (native app) mode. My app is also a pwa and getAuth(app) makes assumptions that its loading in a browser environment which causes this problem.

const firebaseApp = initializeApp(FirebaseConfig);
this.firebaseAuth = isPlatform('hybrid') ? 
    initializeAuth(firebaseApp, {persistence: indexedDBLocalPersistence}) :
    this.firebaseAuth = getAuth(firebaseApp);