Firebase onIdTokenChanged/onAuthStateChanged

399 views
Skip to first unread message

Noman Arain

unread,
Apr 15, 2018, 10:53:24 AM4/15/18
to Firebase Google Group


Documents says that when the state changes, i.e. login/logout then this should trigger. I have the below code in the app.component.ts


firebase.auth().onAuthStateChanged((user: firebase.User) => {
console
.log("user: ", user);
if (user && user.uid) {
   
this.rootPage = HomePage;
} else {
         
this.rootPage = LoginPage;
       
}
});


 

I should come back to the LoginPage after a successful login and then when I logout or even clear the browser history. But after clearing the browser history, my application still keeps sitting on the HomePage.

Reply all
Reply to author
Forward
0 new messages