-
Notifications
You must be signed in to change notification settings - Fork 218
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
Can we add a method to OAuth2Credentials that checks if token is almost expired and refreshes if so? #147
Labels
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Comments
davidxia
added a commit
to spotify/helios
that referenced
this issue
Feb 20, 2018
by using `GoogleCredentials.getRequestMetadata()`. [OAuth2Credentials](https://github.com/google/google-auth-library-java/blob/master/oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java) has methods `refresh()`. But there's no method to check if the token is close to expiring and refresh if so. I want to do [these few lines](https://github.com/google/google-auth-library-java/blob/a8929df490d3751f2349986264290a074dee35e1/oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java#L160-L162), but these methods are private. My use case is that I have a long-lived `GoogleCredentials` instance. I only want to refresh when I need to to minimize unnecessary overhead in making requests to the backend. There are the methods [`getRequestMetadata()`](https://github.com/google/google-auth-library-java/blob/a8929df490d3751f2349986264290a074dee35e1/oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java#L158) which will essentially do the check and refresh logic. So we use this. See googleapis/google-auth-library-java#147.
JustinBeckwith
added
🚨
This issue needs some love.
triage me
I really want to be triaged.
labels
Jun 8, 2018
JustinBeckwith
added
the
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
label
Jun 20, 2018
This is pretty important. We have a good implementation of this in node.js auth library. |
JustinBeckwith
removed
🚨
This issue needs some love.
triage me
I really want to be triaged.
labels
Jun 20, 2018
This was added in 0.10.0 |
davidxia
added a commit
to spotify/helios
that referenced
this issue
Jul 19, 2018
so we can use `Oauth2Credentials.refreshAccessToken()` instead of `getRequestMetadata()`. See googleapis/google-auth-library-java#147.
This was referenced Jul 19, 2018
davidxia
added a commit
to spotify/helios
that referenced
this issue
Aug 15, 2018
so we can use `Oauth2Credentials.refreshAccessToken()` instead of `getRequestMetadata()`. See googleapis/google-auth-library-java#147.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
OAuth2Credentials has methods
refresh()
. But there's no method to check if the token is close to expiring and refresh if so. I want to do these few lines, but these methods are private.My use case is that I have a long-lived
GoogleCredentials
instance. I only want to refresh when I need to to minimize unnecessary overhead in making requests to the backend. There are the methodsgetRequestMetadata()
which will essentially do the check and refresh logic, but this method name and parameter is an awkward fit.Can we expose a new public method in this class that does this?
The text was updated successfully, but these errors were encountered: