[英]What to do when firebase.auth().currentUser.getIdToken() throws “auth/user-token-expired”?
First, I didn't think this was possible.首先,我认为这是不可能的。 The documentation states:
该文档指出:
"Returns the current token if it has not expired. Otherwise, this will refresh the token and return a new one." “如果尚未过期,则返回当前令牌。否则,这将刷新令牌并返回一个新令牌。”
So in what case would it throw this error?那么在什么情况下会抛出这个错误呢? If the refresh token expired, than why wouldn't it instead refresh it?
如果刷新令牌过期,为什么不刷新呢? What is the best way to recover from this?
从中恢复的最佳方法是什么? Set a timer and try again?
设置一个计时器,然后再试一次? Seems like an anti-pattern.
似乎是一种反模式。
This doesn't happen often.这并不经常发生。 I've seen it on safari iPhone, especially when waking up a tab that was signed in anonymously.
我在 safari iPhone 上见过它,尤其是在唤醒匿名登录的标签时。
This happens when the user session is revoked or disabled.当用户 session 被撤销或禁用时,就会发生这种情况。 Revocation happens during big account changes, eg.
撤销发生在大帐户更改期间,例如。 when the user updates their email or password in another session or the user sessions are revoked via the Admin SDK .
当用户在另一个 session 中更新他们的 email 或密码或通过管理员 SDK撤销用户会话时。
The error will be thrown and the user is signed out and deactivated.将引发错误,用户退出并停用。 The expectation is to sign in again or re-authenticate the user.
期望是再次登录或重新验证用户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.