在不重新加载页面的情况下更新电子邮件验证状态 [英] Update the email verification status without reloading page

查看:78
本文介绍了在不重新加载页面的情况下更新电子邮件验证状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Web应用程序中注册后,我将用户重定向到一个页面,告诉他验证其电子邮件.他完成此操作后,我想自动检测VerificationStatus的更改,然后更改页面.遵循这些原则.

After registering in my web app, i redirect the user to a page, where he is told to verify his email. Once he has done that, i want to automatically detect the change of the verificationStatus and then change the page. Something along those lines.

auth.user.subscribe(user => {
  if (!!user && user.emailVerified === true) {
    this.redirectToLogin();
  }
});

我找不到任何方法来检测emailVerified状态的变化,所以我想,也许是有间隔时间在不时地更新用户数据,但是我找不到方法来刷新电子邮件Firebase身份验证中的用户数据.

I couldn't find any way to detect changes of the emailVerified status, so I thought, maybe have an interval runnning that is updating the user data every now and then, but I couldn't find a way how to refresh the user data from firebase authentication.

是否有一种无需重新加载/刷新页面即可更新用户数据的方法?我是否需要刷新authState?如果可能的话,我该怎么办?

Is there a way to update the user data without reloading/refreshing the page? Do i have to refresh the authState? If possible, how can i do that?

这是我想做的,甚至可能吗?

Is what I want to do, even possible?

推荐答案

电子邮件验证状态的更改发生在Firebase服务器上.它不会自动推送到客户端.

The change in email verification status happens on the Firebase servers. It is not automatically pushed to the client.

您可以在客户端上通过调用

On the client you can reload the user data to pick up any changes, by calling User.reload().

另请参阅:

这篇关于在不重新加载页面的情况下更新电子邮件验证状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆