rajayogan / ionic3chat

Chat app using Ionic 3 and firebase
136 stars 89 forks source link

Maintaining session #9

Open ghost opened 6 years ago

ghost commented 6 years ago

Everytime I close and reopen the app, I will have to relogin from beginning. it would be better if it stores the session until I logout.

aliwaqassi commented 6 years ago

@devcer you have to check onAuthStateChanged

firebase.auth().onAuthStateChanged(function(user) {
if (user) {
    // User is signed in.
   this.nav.setRoot('home');
  } else {
    // No user is signed in.
 this.nav.setRoot('loginPage');
  }
});