【问题标题】:Verify email changes not reflected on same session in Firestore验证电子邮件更改未反映在 Firestore 中的同一会话上
【发布时间】:2021-01-19 02:30:37
【问题描述】:

在我的带有 Firestore 的 Ionic 5 应用程序中,我试图在验证电子邮件地址之前阻止用户访问该应用程序。当用户在电子邮件验证完成后点击“继续”按钮时,这是由页面完成的。

以下是检查电子邮件是否经过用户验证的代码。

this.afAuth.auth.currentUser.emailVerified

如果我没有关闭应用程序并在同一个会话中,这总是返回false,但如果我重新启动应用程序,它会返回true。

我不想让我的用户重新启动应用程序,因为这会给用户带来不好的体验。有没有办法可以解决此问题或刷新身份验证更改,以便app.component.ts 中的以下subscription 再次执行。

this.afAuth.authState.subscribe(user=>{
//retrigger this
}) 

【问题讨论】:

  • 你试过await this.afAuth.auth.currentUser.reload();
  • 嗨@Aaron,这行得通。请将其发布为答案。

标签: angular firebase ionic-framework firebase-authentication


【解决方案1】:
await this.afAuth.auth.currentUser.reload();

在您再次尝试访问该帐户之前

【讨论】:

    猜你喜欢
    • 2021-08-02
    • 1970-01-01
    • 2021-09-05
    • 2018-11-26
    • 2021-03-20
    • 1970-01-01
    • 2017-06-12
    • 2015-03-15
    相关资源
    最近更新 更多