Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching access tokens for reuse #33

Closed
hadynz opened this issue Feb 11, 2016 · 3 comments
Closed

Caching access tokens for reuse #33

hadynz opened this issue Feb 11, 2016 · 3 comments

Comments

@hadynz
Copy link

hadynz commented Feb 11, 2016

This is not a bug; more of a question to see what ideas are used out there.

When a user logs in via google-signin, a user object is returned similar to the following:

accessToken: "ya29.hQJD767t_-geYHlFUyW9CCAGBC"
accessTokenExpirationDate: 3599.984444022179
email: "email@gmail.com"
id: "1003109889901343"
idToken: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImYwMmZkODgwOTNmNTQ2Mjg1MD"
name: "My name"
photo: "https://lh5.googleusercontent.com/-/8elejb5_N1A/s120/photo.jpg"
serverAuthCode: "4/4eGtD4XPGKnIGxUUVhVe96XYBz11Y"

The accessToken is what I use when invoking various google api endpoints which I plan to be doing fairly frequently whilst the user is using my app.

Is it expected that I cache this user object for 3599 seconds before needing to re-sign the user? Or would I call a google endpoint to refresh the token, and aim to keep the token alive all the time?

Thoughts?

@skleest
Copy link

skleest commented Aug 25, 2016

+1 -- any ideas?

@tuananhtd
Copy link

I think "keep the token alive all the time" is not ideal. If you want some performance optimization (reduce some additional requests) then just keep track of the expiration date of the token and only refresh it when needed. If you are lazy like me then just always refresh it before use :d

@vonovak
Copy link
Member

vonovak commented May 17, 2018

In an effort to clean the issues up, this is being closed. Please open a new issue if you're experiencing a problem.

@vonovak vonovak closed this as completed May 17, 2018
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

No branches or pull requests

4 participants