问题描述
在firebase 3.0中使用会话持久性似乎是不可能的。这在以前的版本中是可能的:
在3.0版本中没有提及可选的第三个参数:
https://console.firebase.google.com/ )我无法找到更改默认持久性的选项。
也许值得一提的是,您需要等待auth状态来解决。根据文档:
$ b
firebase.auth()。onAuthStateChanged(function(user){
if(user){
//用户已经登录。
} else {
//没有用户登录。
}
});
链接到这里的文档:
It seems impossible to use session persistence in firebase 3.0.
This was possible in the previous version:https://www.firebase.com/docs/web/guide/login/password.html
In version 3.0 there is no mention of the optional 3rd parameter:https://firebase.google.com/docs/reference/js/firebase.auth.Auth#signInWithEmailAndPassword
Also, in the new console (https://console.firebase.google.com/) I cannot find the option to change the default persistence.
It may also be worth mentioning that you need to wait for the auth state to resolve. Per the docs:
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
// User is signed in.
} else {
// No user is signed in.
}
});
Link to the docs here: https://firebase.google.com/docs/auth/web/manage-users
这篇关于Firebase 3.0会话持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!