'Check if email is verified in ionic and firebase [closed]

After a user login , I want to check if the email used by the user is verified. I used to do it like this.

import * as firebase from 'firebase';
verified=false;
if(firebase.auth().currentUser.emailVerified){
 this.verified=true;
}else ...

But now firebase.auth().currentUser.emailVerified is not working anymore. I check if the email is verified after the login because maybe the user did not verify his email on signup.



Solution 1:[1]

try this:

const autur = firebase.auth();
    autur.onAuthStateChanged(user => {
      const veri = user.emailVerified;
      if (veri) {
        // do something
      }
    });

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1