我正在尝试使用Firebase进行持久的Google身份验证。我可以成功登录,但如果我重新加载页面,会话将不会持续。
下面是我的代码:
firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL)
.then(function()
{
let provider = new firebase.auth.GoogleAuthProvider();
firebase.auth().signInWithPopup(provider)
.then(function (result)
{
//Save auth data
});
})
.catch(function(error)
{
console.error(error);
});
这基本上就是文档中所写的内容,应该非常简单。我真的不知道我错过了什么。
此外,我不知道当会话是永久会话时会发生什么,它只会静默地进行身份验证,还是会打开弹出窗口,进行身份验证,然后自动关闭弹出窗口?
谢谢!
https://stackoverflow.com/questions/56266211
复制相似问题