Firebase Auth - User logins don't persist

I’m using Firebase authentication (Email + pw) and everything seems to be working great (users can sign up / log in). However, if they quit the application completely (iOS) and then open it again, they have to sign in - is this a limitation of Expo? It seemed to work when I built the application only using React Native.

1 Like

This shouldn’t be a limitation of Expo. It’s unclear to me how Firebase is automatically persisting the logged-in-user state. Figuring that out would make it easier to diagnose what the cause of this could be.

1 Like

Did you happened to use the version 4.5.1 of firebase?

It had a bug that made the logins expire when restarting the app. It’s fixed in 4.5.2.

More: https://github.com/firebase/firebase-js-sdk/issues/223

1 Like

Thanks @ide and @jannevickholm, I got it to work by updating firebase and wrapping my sign in / login functions with:

firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL).then(() => { //signin/login }

I’m having a similar issue, however it’s persisting when I close and open the app, but expiring the auth and session a couple of hours after last use. I can’t find a solution and firebase.auth.Auth.Persistence.LOCAL didn’t do the trick.

Here is my question on StackOverflow with more context: