gpt4 book ai didi

session - Firebase 3.0 session 持久性

转载 作者:行者123 更新时间:2023-12-04 11:02:58 25 4
gpt4 key购买 nike

在 firebase 3.0 中似乎不可能使用 session 持久性。

这在以前的版本中是可能的:
https://www.firebase.com/docs/web/guide/login/password.html

authWithPassword() takes an optional third parameter which is an object containing any of the following settings:

remember - String
If not specified - or set to default - sessions are persisted for as long as you have configured in the Login & Auth tab of your App Dashboard. To limit persistence to the lifetime of the current window, set this to sessionOnly. A value of none will not persist authentication data at all and will end authentication as soon as the page is closed.



在 3.0 版本中没有提到可选的第三个参数:
https://firebase.google.com/docs/reference/js/firebase.auth.Auth#signInWithEmailAndPassword

signInWithEmailAndPassword(email, password)
returns firebase.Promise containing non-null firebase.User



此外,在新控制台 ( https://console.firebase.google.com/ ) 中,我找不到更改默认持久性的选项。

最佳答案

可能还值得一提的是,您需要等待 auth 状态解析。根据文档:

The recommended way to get the current user is by setting an observer on the Auth object:


firebase.auth().onAuthStateChanged(function(user) {
if (user) {
// User is signed in.
} else {
// No user is signed in.
}
});

链接到此处的文档: https://firebase.google.com/docs/auth/web/manage-users

关于session - Firebase 3.0 session 持久性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37568644/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com