Tha*_*ude 4 firebase firebase-authentication
如果用户验证了他的电子邮件,我如何能够实时检查?
我的流程是这样的:
现在我想:
为此,我需要一种从 firebase 获取用户数据的方法。通常您只使用 onAuthStateChanged 回调来获取用户数据,但我需要明确获取当前数据。
我该怎么做?
找到方法了!
firebase.auth().currentUser.reload()
Run Code Online (Sandbox Code Playgroud)
将获取当前用户数据。所以我所要做的就是:
this.checkForVerifiedInterval = setInterval(() => {
firebase.auth()
.currentUser
.reload()
.then(ok => {
if (firebase.auth().currentUser.emailVerified) {
this.props.history.push("/verification-email-verified")
window.Materialize.toast("Email verified.", 3000)
clearInterval(this.checkForVerifiedInterval)
}
})
}, 1000)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
996 次 |
| 最近记录: |