google-auth-library-python-oauthlib
google-auth-library-python-oauthlib copied to clipboard
Add optional expiration parameter to google.oauth2.credentials.Credentials
I store the credentials object in the session, and the expiration as well, since I need to call credentials.valid to check the creds validity on session setup.
Currently I have to do this:
creds = session['creds']
expiry = creds.pop('expiry')
creds = google.oauth2.credentials.Credentials(**creds)
creds.expiry = datetime.utcfromtimestamp(expiry)
if not creds.valid:
return False
Would be nice to add exiry to Credentials constructor that defaults to None so as not to break backward compatibillity