Firebase-一小时后丢失身份验证会话 [英] Firebase - Losing Auth Session After An Hour

查看:71
本文介绍了Firebase-一小时后丢失身份验证会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Firebase身份验证添加到了我的Reactjs(和Redux)网络应用程序中,并且一切运行正常.我正在使用电子邮件/密码登录,并调用firebase.auth().signInWithEmailAndPassword,该请求在重新加载,更改选项卡等操作时仍然存在.但是,大约一个小时后,身份验证会话似乎已到期,并且currentUser设置为null.感觉Firebase控制台中应该有一个设置,但是在搜索之后,我什么都找不到.

I added Firebase auth to my Reactjs (and Redux) web app and everything works perfectly. I'm using email / password sign in, and call firebase.auth().signInWithEmailAndPassword which persists on reloads, tab changes, etc. However, after about an hour, the auth session appears to expire and currentUser is set to null. It feels like there should be a setting somewhere in the Firebase console, but after searching through it, I can't find anything.

任何帮助将不胜感激!

推荐答案

我遇到了完全相同的问题,onAuthStateChanged总是在1小时后触发,并且用户已断开连接.而且firebase.auth().currentUser.getIdToken(true)也不起作用,这都是因为...必须在Google控制台中为我的Google API密钥启用令牌服务API.问题解决了!

I had the exact same issue, onAuthStateChanged was always triggered after 1 hour and the user was disconnected. And firebase.auth().currentUser.getIdToken(true) didn't help either, all because... Token Service API had to be enabled for my Google API key in the Google console. Problem solved!

这篇关于Firebase-一小时后丢失身份验证会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆