Search code examples
pythonpython-3.xgoogle-apigoogle-oauthservice-accounts

Google service account gives UNAUTHENTICATED error


My code runs smoothly on the local server. On GCP server where python server is started as a linux systemd service, after few hours of restart it gives me

Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential.

Im using gspread to access google spreadsheets.

Scope "https://www.googleapis.com/auth/spreadsheets"


Solution

  • Issue in gspread can be fixed using

    client.login()

    Issue on Github