【问题标题】:pydrive.auth.RefreshError: Access token refresh failed: invalid_grant: Token has been expired or revokedpydrive.auth.RefreshError:访问令牌刷新失败:invalid_grant:令牌已过期或撤销
【发布时间】:2020-09-10 10:29:33
【问题描述】:

所以我正在构建一个项目,其中包括我在谷歌驱动器中保存一些内容,这是我使用的代码的一部分

gauth = GoogleAuth()
gauth.LoadCredentialsFile("mycreds.txt")
if gauth.credentials is None:
    gauth.LocalWebserverAuth()
elif gauth.access_token_expired:
    gauth.Refresh()
else:
    gauth.Authorize()
gauth.SaveCredentialsFile("mycreds.txt")
drive = GoogleDrive(gauth)

它运行了几天,但后来我开始收到此错误

pydrive.auth.RefreshError: Access token refresh failed: invalid_grant: Token has been expired or revoked.

它来自gauth.Refresh() 行,所以有谁知道为什么会发生这种情况以及如何解决它?

【问题讨论】:

    标签: python pydrive


    【解决方案1】:

    我遇到了与pydrive2 类似的问题。该问题是由您的 GDrive 被吊销引起的。

    尝试删除根目录中的credentials.json 并再次进行身份验证。

    【讨论】:

    • 谢谢,这是我前段时间解决的问题,但忘记在这里发布答案
    • 它一直在发生......知道为什么我的凭据一直无效吗?
    猜你喜欢
    • 1970-01-01
    • 2019-01-21
    • 2019-04-12
    • 2023-03-10
    • 2021-08-10
    • 2021-05-09
    • 2018-06-05
    • 1970-01-01
    • 2018-04-23
    相关资源
    最近更新 更多