【发布时间】:2022-02-10 11:31:29
【问题描述】:
我将 Firebase 与 VueJS 一起使用。到目前为止,注册,登录工作正常,但是一旦我用 F5 重新加载页面或加载页面并直接写入浏览器地址栏,然后身份验证会话被终止,用户就不再登录了。只要我不重新加载页面,它就可以正常工作,即使我单击路由链接或被重定向到其他页面,用户会话也会保持活动状态。顺便说一句,我在哪里重新加载页面并不重要。
我的登录方式:
firebase.auth().signInWithEmailAndPassword(this.username, this.password).then(
(user) => {
if (user.emailVerified === false) {
firebase.auth().signOut()
} else {
// redirect to lobby page if user is verified and signed in
this.$router.push('/lobby')
}
},
function(err) {
console.log(err.message)
}
)
【问题讨论】:
标签: node.js firebase vuejs2 firebase-authentication