【问题标题】:Using Google+ API causes HttpAccessTokenRefreshError使用 Google+ API 会导致 HttpAccessTokenRefreshError
【发布时间】:2016-03-21 18:42:19
【问题描述】:

我想通过 Google+ API 使用服务器端通信来检索当前用户的个人资料信息。我根据python的谷歌示例登录用户:

credentials = client.credentials_from_clientsecrets_and_code(
    CLIENT_SECRET_FILE,
    ['https://www.googleapis.com/auth/drive.appdata', 'profile', 'email'],
    code)

然后我调用 Google+ API:

http_auth = credentials.authorize(httplib2.Http())
service = build('plus', 'v1', http = http_auth)
google_request = service.people().list(userId = 'me', collection = 'visible')
result = google_request.execute()

这会引发以下错误:

HttpAccessTokenRefreshError: invalid_grant

有人知道我能做些什么吗?

【问题讨论】:

    标签: python google-api google-authentication


    【解决方案1】:

    我通过使用正确的方法people().get()而不是people().list()解决了这个问题

    起初我想删除这个问题,因为这个话题看起来很愚蠢,但我从 Github 上的代码示例中复制粘贴了错误的 API 调用,因此我可以想象其他人也会遇到这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-29
      • 1970-01-01
      • 2020-12-01
      • 2021-06-16
      • 1970-01-01
      • 1970-01-01
      • 2011-08-31
      • 1970-01-01
      相关资源
      最近更新 更多