Nurdin
Nurdin

Reputation: 23883

Google Cloud - oauth2client.client.HttpAccessTokenRefreshError: invalid_grant

I got this error message when trying to execute Google Prediction API.

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

My credential details

{
    "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": "[email protected]",
    "invalid": false,
    "assertion_type": null,
    "kwargs": {},
    "client_secret": null,
    "revoke_uri": "https://accounts.google.com/o/oauth2/revoke",
    "user_agent": null
}

Upvotes: 7

Views: 8551

Answers (1)

Adam
Adam

Reputation: 5995

For future readers of this question, if this issue happens locally it can be caused by an out of sync system clock. Otherwise, this was also a known issue on App Engine at around the same time this question was posted. Details of both causes can be found in an issue report on the oauth2client GitHub project page from last year:

oauth2client.client.HttpAccessTokenRefreshError: invalid_grant: Bad Request

Upvotes: 3

Related Questions