我正在使用电子邮件&登录用户的密码验证,从我的firebase仪表板我已将会话到期时间设置为2个月。但是当我从后台关闭我的应用程序然后重新打开应用程序后我得到var user = ref.getAuth();为null
firebase不会解决这个问题吗?如何让用户长时间登录?
以下是我用来登录用户的一段代码。我正在使用react-native
ref.authWithPassword({
email : 'username',
password : 'password'
}, function(error, authData) {
if (error) {
console.log("Login Failed!", error);
} else {
navigatorReference.push({name:'myFeed'})
console.log("Authenticated successfully with payload:", authData);
}
});
答案 0 :(得分:0)
Firebase should take care of this. Double check your configuration in the Login & Auth
tab in your App Dashboard to make sure you have that setup properly.
You could also try passing along the configuration like so...
ref.authWithPassword({
email : 'username',
password : 'password'
}, function(error, authData) { /* Your Code */ }, {
remember: "default"
});