我可以在不注销的情况下获得更新的email验证吗? [英] Can I get updated emailVerified without logging out?
问题描述
我的注册流程有以下流程:
I have following flow for my sign up process:
-
用户填写详细信息并注册(获取发送验证邮件) )
User fills out details and signs up (gets send verification email)
此用户登录后,但看到要求进行电子邮件验证的屏幕
After this user is logged in, but sees a screen asking to for email verification
用户验证他们的电子邮件并返回应用
User verifies their email and goes back to app
在此阶段,如何获取新的用户数据将有 emailVerified
字段而不记录用户?
At this stage how can I get new user data that will have emailVerified
field without logging user out?
我预计 auth()。onAuthStateChanged
将被触发一次 emailVerified
更改为true,但这不会发生,也无法在firebase文档中找到任何刷新功能来手动获取此数据。
I expected auth().onAuthStateChanged
to be fired once emailVerified
changes to true, but that does not happen, nor can I find any refresh function in firebase docs to get this data manually.
我只能通过注销并重新登录来获得 emailVerified
的新值,但理想的情况是喜欢避免这种情况。
Only way I can get that new value for emailVerified
is by loging out and loging back in, but ideally would like to avoid this.
更新:这是使用JavaScript SDK
update: this is using JavaScript SDK
推荐答案
基于android我做了
Based on android I did
firebase.auth().currentUser.reload().then(() => {
console.log(firebase.auth().currentUser)
})
这会返回有关用户的更新信息,由于某种原因,我无法在文档中的任何位置找到此信息
this returns updated information about the user, I couldn't find this anywhere in the docs for some reason
这篇关于我可以在不注销的情况下获得更新的email验证吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!