After learning sending email verification is possible in latest firebase, although the docs are missing that, I wanted to test it for myself.
Using the snippet below:
Auth.$onAuthStateChanged(function(firebaseUser) {
if (firebaseUser) {
console.log(firebaseUser);
if (firebaseUser.emailVerified) {
// console.log(firebaseUser.emailVerified);
toastr.success('Email verified');
} else {
toastr.info('Do verify email');
}
}
})
The console.log(firebaseUser.emailVerified)
returns false, always, although a send verification was initiated, email received, and clicked on.
Right after login with email, I check to see if user is verified, if not, email should be sent:
Auth.$signInWithEmailAndPassword(email, password)
.then(function(firebaseUser) {
if (!firebaseUser.emailVerified) {
firebaseUser.sendEmailVerification();
console.log('Email verification sent');
}
$state.go('home');
})
Under my https://console.firebase.google.com/project/my-app-name/authentication/emails
, everything is by default, with a verify link as:
Follow this link to verify your email address.
https://my-app-name.firebaseapp.com/__/auth/handler?mode=<action>&oobCode=<code>
The email I use to sign up receives the verify email message, yet, clicking the link does nothing to change the user.emailVerified
to true.
Are the steps outline here all there is, or there's yet another step not found in the docs?
reload
method on the current user.firebaseUser.reload()
that should refresh theemailVerified
var. – Tope