I've run into a problem during development of email verification with firebase.
Whenever I try to verify the email address, I can't get the info that user's email address is verified.
I have a code like this:
constructor(private afAuth: AngularFireAuth, public navCtrl: NavController, public navParams: NavParams) {
}
ionViewWillEnter() {
this.afAuth.auth.onAuthStateChanged(user => {
if (user && user.emailVerified) {
this.navCtrl.setRoot(ShoppingListPage);
}
});
}
proceedButtonHandler() {
this.afAuth.auth.onAuthStateChanged(user => {
if (user && user.emailVerified) {
this.navCtrl.setRoot(ShoppingListPage);
}
});
}
But after I verify the email address and run proceedButtonHandler function, in user.emailVerified field I always get "false" result, unless I refresh the page.
What is the right way to know if user's email is currently verified? And is there any way to watch for "emailVerified" field changes and redirect the user to another page without clicking the button? (there is an attempt to do this in "ionViewWillEnter" function)