我正在构建一个vue / node / firebase应用程序。我正在使用https://firebase.google.com/docs/auth/web/email-link-auth中所述的电子邮件链接登录,并尝试按照此处https://firebase.google.com/docs/auth/web/auth-state-persistence中所述将持久性设置为本地。看起来很简单,但是它无法正常工作,并且因为回退和f5将您赶出局面而破坏了整个应用程序的体验。以下是代码和错误错误。任何提示将不胜感激,因为它现在对我来说已成为一个巨大的时间流失。提前非常感谢您!
'''
created(){
if (firebase.auth().isSignInWithEmailLink(window.location.href)){
let email = window.localStorage.getItem('emailForSignIn')
if (!email){
email = window.prompt('Please provide your email for confirmation')
}
this.$store.dispatch('notify', 'Signing in ...')
firebase.auth().setPersistence(firebase.auth.Auth.Persistence.SESSION)
firebase.auth().signInWithEmailLink(email, window.location.href)
.then(() => {
const url = new URL(window.location.href)
const exists = url.searchParams.get('exists')
if (exists == 'true') this.$router.push('/dashboard')
else this.$router.push('/join')
window.localStorage.removeItem('emailForSignIn')
})
.catch(error => this.$store.dispatch('notify', error.message))
}
},
'''
给我这个...
TypeError:无法读取未定义的属性“ Persistence”
再次感谢
Allan S