expired access token

I have no idea whether this is the correct "location" to post this, but here goes. We are using the pygsheets/pydrive (are these the same? we import GoogleAuth and GoogleDrive from pydrive.auth and ptdrive.drive respectively) API's to store and retrieve session data using python to/from a cloud-based server.  Storing this data is no longer possible because of this:

access_token is expired. Now: 2024-02-01 23:29:51.143016, token_expiry: 2024-01-30 20:08:08
Refreshing access_token
Uploading all data file to google drive
file_cache is only supported with oauth2client<4.0.0

What do we need to do to get this interface operational again?

1 1 169
1 REPLY 1

Hi @apdobaj,

Welcome to Google Cloud Community!

Problem:

  • Expired access token prevents data storage to Google Drive using pygsheets/pydrive.
  • file_cache incompatibility with newer oauth2client versions.

Solutions:

  1. Refresh Expired Token:

    • Try gauth.Refresh() first.
    • If that fails, manually re-authenticate through gauth.LocalWebserverAuth().
  2. Address file_cache Issue:

    • Upgrade PyDrive if possible.
    • Consider alternative caching mechanisms or manage credentials manually.

Additional Tips:

  • Review consent screen settings (avoid 7-day expiration).
  • Manage token limits to avoid reaching the 100-token limit per client ID.