How do I detect if a user is already logged in Firebase?
https://firebase.google.com/docs/auth/web/manage-users
You have to add an auth state change observer.
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
// User is signed in.
} else {
// No user is signed in.
}
});
You can also check if there is a currentUser
var user = firebase.auth().currentUser;
if (user) {
// User is signed in.
} else {
// No user is signed in.
}