I'm trying to build a website that uses email auth for users. However, everytime I try to sign up or log in a user, the firebase.auth().onAuthStateChanged function fires, but doesn't recognize that a user has logged in or signed up. This is my current code. I know it works because it will alert me, "No user!" after every log in or sign up and because I can go into my Firebase console and see that the user has signed up. If anyone knows how to fix this, I would appreciate it!
Thanks!
Code:
function initApp() {
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
alert("Signed in user!")
} else {
alert("No user!")
}
});
}
window.onload = function() {
initApp();
};
Aucun commentaire:
Enregistrer un commentaire