我一直在与Google API合作。有时我的刷新令牌刷新刷新,而其他时候它会失败并导致A fresherror。'为什么?如何修复?

发布于 2025-02-01 00:25:17 字数 176 浏览 2 评论 0原文

错误:

google.auth.exceptions.refresherror :('invalid_grant:令牌已过期或已撤销。 P>

。使用不同的帐户,从未遇到任何问题。我为这两者都使用相同的Python Oauth Quickstart。

Error:

google.auth.exceptions.RefreshError: ('invalid_grant: Token has been expired or revoked.', {'error': 'invalid_grant', 'error_description': 'Token has been expired or revoked.'})

However, another app I use, with a different account, never runs into any issues. I use the same Python OAuth Quickstart for both.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

箹锭⒈辈孓 2025-02-08 00:25:17

令牌已过期或吊销。

基本上意味着用户已撤销您的访问权限或Google拥有。用户可以随时在其Google帐户中直接删除您的访问。

如果您使用的是Gmail范围,则Google已过期令牌

  • ,并且用户更改其密码。您的刷新令牌可能会被吊销。
  • 如果您的应用程序仍在测试中,并且刷新令牌越多,则七天历时,用户同意将被删除,并且将撤销刷新令牌。
  • 如果在六个月内尚未使用刷新令牌,刷新令牌将被撤销。
  • 如果用户对您的应用进行了验证,则会获得刷新令牌,如果再次这样做,您将获得另一个刷新令牌。两者都会起作用。您可以为用户拥有多达50个出色的刷新令牌。如果您再次要求,则第一个将过期。确保您始终存储最新的刷新令牌。

无论您的原因是什么原因,您的应用程序应以某种方式配置,以便如果刷新令牌已过期,请再次请求授权。

Token has been expired or revoked.

Basically means just that either the user has revoked your access or google has. Users can remove your access directly in their google account when ever they want to.

Google expired tokens

  • If you are using a gmail scope, and the user changes their password. Your refresh token will probably be revoked.
  • If your app is still in testing and the refresh token is more then seven days old the users consent will be removed and the refresh tokens will be revoked.
  • If the refresh token has not been used in more then six months the refresh token will be revoked.
  • If the user authroizes you app you get a refresh token, if the do it again you get another refresh token. both will work. You can have up to 50 outstanding refresh tokens for a user. If you request again then the first one will be expired. Ensure you are always storing the most recent refresh token.

no matter what the cause your application should be configured in a way as to request authorization from them again if the refresh token has expired.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文