【问题标题】:Check if email is verified in ionic and firebase [closed]检查是否在 ionic 和 firebase 中验证了电子邮件 [关闭]
【发布时间】:2021-03-13 18:53:47
【问题描述】:

用户登录后,我想检查他使用的电子邮件是否经过验证。 我以前也是这样的。

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

但是现在firebase.auth().currentUser.emailVerified 不再工作了。 我在登录后检查电子邮件是否经过验证,因为如果用户请求发送电子邮件验证,第一次可能无法工作。

【问题讨论】:

    标签: angular firebase ionic-framework firebase-authentication


    【解决方案1】:

    试试这个:

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

    【讨论】:

    • 感谢您的帮助,但它不起作用。
    • 它给了我一个错误。 “'typeof import node_modules/firebase/index' 类型上不存在 auth()”
    • 我在 ionic 的文档中读到 auth() 和 emailVerified 现在已弃用。
    猜你喜欢
    • 2021-04-11
    • 2019-09-04
    • 2021-05-17
    • 2021-05-16
    • 2023-01-23
    • 1970-01-01
    • 2020-11-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多