google-auth-library-python-oauthlib icon indicating copy to clipboard operation
google-auth-library-python-oauthlib copied to clipboard

Add optional expiration parameter to google.oauth2.credentials.Credentials

Open corby opened this issue 6 years ago • 0 comments

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

corby avatar Mar 20 '19 18:03 corby