Skip to content

Conversation

pgentile
Copy link

@pgentile pgentile commented Sep 2, 2025

If the expiry is not saved in credentials, we are not able to rebuild a valid token from the state of the session. So we have compute the expiry date of the token and set it in the credentials.

No expiry in credentials:

cached = json.loads(creds.to_json())
creds = Credentials.from_authorized_user_info(cached_token_info, SCOPES)
assert creds.valid == False
assert creds.expired == True

Expiry in credentials:

cached = json.loads(creds.to_json())
creds = Credentials.from_authorized_user_info(cached_token_info, SCOPES)
assert creds.valid == True
assert creds.expired == False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant