0
votes

I am using firebase email login with my ionic app.

I haven't set up any auth state persistence in my entire app.

When I close (not minimize, really close it) and re-open the app, the user is still logged in (which is ok and my expected behaviour).

on important pages I just check if the user is authenticated and it all works fine:

if(firebase.auth().currentUser !== null){

  console.log('user is logged in!');

else{
  //redirect user to login
}

So I am just wondering, if firebase uses local storage to persist auth state on the background by default?

what I am trying to achieve?: let users sign in once and never log them out unless they log out by themselves or uninstall the app

what I have right now in the app?: currently it is working as expected, just want to confirm that firebase is keeping auth state on default

1

1 Answers

1
votes

From the documentation on auth state persistence:

For a web application, the default behavior is to persist a user's session even after the user closes the browser. This is convenient as the user is not required to continuously sign-in every time the web page is visited on the same device.

So, the answer to your question is yes.