Firebase 身份验证 expiresIn (令牌过期所需的时间)

sud*_*aki 5 firebase firebase-authentication

createUserWithEmailAndPassword在 (或)的响应中,signInWithEmailAndPassword我们有_tokenResponse.expiresIn它等于 3600 秒

如何将此值修改为更长的值,例如 30 天或类似的值?

Dha*_*raj 4

该令牌的持续时间无法更改,这并不意味着会话已过期。检查Firebase 3.x - 令牌/会话过期

这只是access_token,您可以使用 获得一个新的refresh_token。Firebase Auth SDK 在幕后为您完成此操作。您只需调用getIdToken(),每次都会获得一个有效的令牌。检查当当前访问令牌已过期时,我如何获取新的访问令牌,google firebase auth?了解更多信息。

如果您使用会话 cookie,您可以指定 cookie 中设置的令牌的有效性(最多 14 天),但这对于服务器端呈现的 Web 应用程序来说是理想的选择。