如果用户验证了他的电子邮件,我如何能够实时签入?
我的流程是这样的:
现在我想:
为此,我需要一个从firebase获取用户数据的方法。通常,您只需使用onAuthStateChanged回调来获取用户数据,但我需要显式地获取当前数据。
我该怎么做?
发布于 2018-05-10 12:16:37
找到办法了!
firebase.auth().currentUser.reload()将获取当前用户数据。所以我要做的就是:
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)https://stackoverflow.com/questions/50271839
复制相似问题