Skip to content

Token expiration tolerance should be configurable #249

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

Closed
CSEMike opened this issue Aug 31, 2017 · 8 comments
Closed

Token expiration tolerance should be configurable #249

CSEMike opened this issue Aug 31, 2017 · 8 comments

Comments

@CSEMike
Copy link

CSEMike commented Aug 31, 2017

The expiryDelta used to calculate token validity is fixed at 10 seconds.
https://github.com/golang/oauth2/blob/master/token.go#L21

This issue tracks making this value configurable. Why? To support scenarios where the token may be not be used until >10s in the future.

Token validity is used to refresh cached values, e.g.,
https://github.com/golang/oauth2/blob/master/oauth2.go#L260

An alternative API would be to support invalidation of the token cache. But, in either case, a way to configure the max acceptable age of a token is necessary to avoid corner cases when expiration is near.

@narqo
Copy link
Contributor

narqo commented Oct 24, 2017

👍 for the issue.

My usecase is to force refresh stored tokens and I need to have custom expiryDelta.

Another possible solution might be to expose tokenRefresher, so one would have much more control over the refreshment process.

@fharding1
Copy link

I've opened a PR that would accommodate this issue here: #396

@andig

This comment was marked as outdated.

@andig

This comment was marked as outdated.

@andig

This comment was marked as outdated.

@andig
Copy link
Contributor

andig commented Jul 3, 2023

Going through the commits it seems we could already do this with 1e7f329.

@andig
Copy link
Contributor

andig commented Jul 3, 2023

That said: looks like this issue could be closed @CSEMike

@seankhliao
Copy link
Member

Out of scope, use your own tokensource.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants