With the following Firebase email authentication code, how do you know whether authentication was successful?
firebase.auth().signInWithEmailAndPassword(emai
If nothing was cached then it was successful.
var isSuccessful = true
firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) {
// Handle Errors here.
var isSuccessful = false
var errorCode = error.code;
var errorMessage = error.message;
if (errorCode === 'auth/wrong-password') {
alert('Wrong password.');
} else {
alert(errorMessage);
}
console.log(error);
})
finally {
if(isSuccessful)
//Success!
}