I am using gspread 0.2.5 and oauth2client 1.4.11. On a Mac with Python 2.7.5 I can authenticate to Google and retrieve data using this code:
from oauth2client.client import SignedJwtAssertionCredentials
scopes = ['https://spreadsheets.google.com/feeds/', 'https://docs.google.com/feeds']
credentials = SignedJwtAssertionCredentials(client_email, private_key, scopes)
gc = gspread.authorize(credentials)
On Ubuntu 14.04 Linux with Python 2.7.6 and identical credentials, I see this error:
Traceback (most recent call last):
File "scripts/website-people-update.py", line 76, in <module>
sheets = load_sheets(gdocs_client_email, gdocs_private_key)
File "scripts/website-people-update.py", line 25, in load_sheets
gc = gspread.authorize(credentials)
File "/usr/local/lib/python2.7/dist-packages/gspread/client.py", line 335, in authorize
client.login()
File "/usr/local/lib/python2.7/dist-packages/gspread/client.py", line 98, in login
self.auth.refresh(http)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 598, in refresh
self._refresh(http.request)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 769, in _refresh
self._do_refresh_request(http_request)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 834, in _do_refresh_request
raise AccessTokenRefreshError(error_msg)
AccessTokenRefreshError: invalid_grant
I’m at a bit of a loss. Searches for invalid_grant
come up with solutions that address incorrect configuration, rather than platform-specific failure.