fix(connection): set token expiration date for GCE#213
Merged
silvolu merged 1 commit intogoogleapis:masterfrom Sep 23, 2014
Merged
fix(connection): set token expiration date for GCE#213silvolu merged 1 commit intogoogleapis:masterfrom
silvolu merged 1 commit intogoogleapis:masterfrom
Conversation
8be5e2d to
ec5f537
Compare
Contributor
|
Can you please add a test? |
ec5f537 to
9ab8488
Compare
Contributor
Author
|
Good thinking. Added 👍 |
A response from the GCE metadata server responds with data in a different format from that of the GAPIToken() request. Instead of looking for a property that doesn't exist `token_expires`, we now calculate the expiration timestamp from `expires_in`. For more, see [Authenticating from Google Compute Engine][auth]. [auth]:https://developers.google.com/compute/docs/authentication#applications Fixes googleapis#212
9ab8488 to
2eb9903
Compare
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Contributor
|
Yes, I think we should re-request the token, and the approach you suggest is definitely better. We should catch 401s "Invalid credentials" and refetch the token, as described here. |
Contributor
Author
|
Cool. I'll send a separate PR for that. |
Contributor
|
SGTM. Merging this one. |
Contributor
|
SGTM. Merge it up. |
silvolu
added a commit
that referenced
this pull request
Sep 23, 2014
fix(connection): set token expiration date for GCE
4 tasks
sofisl
pushed a commit
that referenced
this pull request
Sep 15, 2022
4 tasks
sofisl
pushed a commit
that referenced
this pull request
Sep 16, 2022
sofisl
pushed a commit
that referenced
this pull request
Oct 5, 2022
4 tasks
sofisl
pushed a commit
that referenced
this pull request
Oct 5, 2022
4 tasks
sofisl
pushed a commit
that referenced
this pull request
Jan 27, 2026
This was referenced Jan 27, 2026
sofisl
pushed a commit
that referenced
this pull request
Jan 27, 2026
This was referenced Jan 27, 2026
GautamSharda
pushed a commit
that referenced
this pull request
Feb 2, 2026
4 tasks
sofisl
pushed a commit
that referenced
this pull request
Feb 3, 2026
* build: fix codecov uploading on Kokoro * build: fix codecov uploading on Kokoro
4 tasks
4 tasks
GautamSharda
pushed a commit
that referenced
this pull request
Feb 3, 2026
sofisl
pushed a commit
that referenced
this pull request
Feb 4, 2026
This was referenced Feb 4, 2026
sofisl
pushed a commit
that referenced
this pull request
Feb 5, 2026
* build: fix codecov uploading on Kokoro * build: fix codecov uploading on Kokoro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A response from the GCE metadata server responds with data in a
different format from that of the GAPIToken() request. Instead of
looking for a property that doesn't exist
token_expires, we nowcalculate the expiration timestamp from
expires_in.For more, see Authenticating from Google Compute Engine.
Fixes #212