【问题标题】:Google Cloud - oauth2client.client.HttpAccessTokenRefreshError: invalid_grant谷歌云 - oauth2client.client.HttpAccessTokenRefreshError: invalid_grant
【发布时间】:2016-05-28 04:56:06
【问题描述】:

我在尝试执行 Google Prediction API 时收到此错误消息。

raise HttpAccessTokenRefreshError(error_msg, status=resp.status)
oauth2client.client.HttpAccessTokenRefreshError: invalid_grant

我的凭据详细信息

{
    "scopes": [],
    "private_key": "XXXXX",
    "id_token": null,
    "token_uri": "https://accounts.google.com/o/oauth2/token",
    "token_info_uri": null,
    "token_response": null,
    "client_id": null,
    "scope": "https://www.googleapis.com/auth/prediction https://www.googleapis.com/auth/devstorage.read_only",
    "token_expiry": null,
    "_class": "SignedJwtAssertionCredentials",
    "refresh_token": null,
    "_module": "oauth2client.client",
    "private_key_password": "notasecret",
    "access_token": null,
    "service_account_name": "account-1@myapp-1136.iam.gserviceaccount.com",
    "invalid": false,
    "assertion_type": null,
    "kwargs": {},
    "client_secret": null,
    "revoke_uri": "https://accounts.google.com/o/oauth2/revoke",
    "user_agent": null
}

【问题讨论】:

  • 这是暂时性错误吗?这通常意味着您的访问令牌已过期,需要使用 oauth2client.client.Credentials.refresh() 进行刷新。
  • 您找到解决此问题的方法了吗?
  • 老问题,但这对我有帮助 stackoverflow.com/a/14288818/785808

标签: python oauth-2.0 google-prediction


【解决方案1】:

对于此问题的未来读者,如果此问题发生在本地,则可能是系统时钟不同步造成的。否则,在发布此问题的同时,这也是 App Engine 上的一个已知问题。这两个原因的详细信息可以在去年的 oauth2client GitHub 项目页面上的问题报告中找到:

oauth2client.client.HttpAccessTokenRefreshError: invalid_grant: Bad Request

【讨论】:

    猜你喜欢
    • 2016-04-24
    • 2013-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-03
    • 2020-09-10
    • 1970-01-01
    • 2017-11-14
    相关资源
    最近更新 更多