6

私はこの例に従っています

https://code.google.com/p/google-api-python-client/source/browse/samples/service_account/tasks.py

  credentials = SignedJwtAssertionCredentials(
      '141491975384@developer.gserviceaccount.com',
      key,
      scope='https://www.googleapis.com/auth/tasks')
  http = httplib2.Http()
  http = credentials.authorize(http)

  service = build("tasks", "v1", http=http)

  # List all the tasklists for the account.
  lists = service.tasklists().list().execute(http=http)
  pprint.pprint(lists)

問題は、時々動作し、リストをJSONとして取得し、プログラムをさらに数回実行した後、エラーが発生することです

  File "/usr/local/lib/python2.7/site-packages/oauth2client/client.py", line 710, in _do_refresh_request
    raise AccessTokenRefreshError(error_msg)
oauth2client.client.AccessTokenRefreshError: invalid_grant
4

3 に答える 3

0

私はGoogleドライブのインターフェースですが、同じエラーが見つかりました。Issue 160には、ローカル コンピューターで適切な時刻を設定するという報告があります。Mac Mavericks にアップグレードして以来、システム時刻を更新し続ける必要があることに気付きました。報告されたエラーを取得していたので、システム時間を現在の状態に戻し、エラーを解消しました。

于 2014-01-12T23:43:09.947 に答える