Skip to content

Commit

Permalink
fix: expiry in compute_engine.IDTokenCredentials (#1327)
Browse files Browse the repository at this point in the history
fixes #1323
  • Loading branch information
juzna authored Jun 9, 2023
1 parent a9b8f12 commit 56a6159
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion google/auth/compute_engine/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def _call_metadata_identity_endpoint(self, request):
six.raise_from(new_exc, caught_exc)

_, payload, _, _ = jwt._unverified_decode(id_token)
return id_token, datetime.datetime.fromtimestamp(payload["exp"])
return id_token, datetime.datetime.utcfromtimestamp(payload["exp"])

def refresh(self, request):
"""Refreshes the ID token.
Expand Down
2 changes: 1 addition & 1 deletion tests/compute_engine/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ def test_get_id_token_from_metadata(
}

assert cred.token == SAMPLE_ID_TOKEN
assert cred.expiry == datetime.datetime.fromtimestamp(SAMPLE_ID_TOKEN_EXP)
assert cred.expiry == datetime.datetime.utcfromtimestamp(SAMPLE_ID_TOKEN_EXP)
assert cred._use_metadata_identity_endpoint
assert cred._signer is None
assert cred._token_uri is None
Expand Down

0 comments on commit 56a6159

Please sign in to comment.