firebase authenticationchanged code example
Example 1: google auth.onstatechange
firebase.auth().onAuthStateChanged(function(user) { if (user) {
// User is signed in.
}
else {
// No user is signed in.
}});
Example 2: firebase.auth.currentuser
var user = firebase.auth().currentUser;if (user) { // User is signed in.} else { // No user is signed in.}