Skip to content

Commit 449ca2d

Browse files
eesheeshgcf-owl-bot[bot]arithmetic1728
authored
feat: Improve handling of clock skew (#858)
* Allow up to 60 seconds of skew * Add actionable/helpful error message text. * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: arithmetic1728 <[email protected]>
1 parent 951820a commit 449ca2d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/google-auth/google/auth/_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import urllib
2121

2222

23-
CLOCK_SKEW_SECS = 10 # 10 seconds
23+
CLOCK_SKEW_SECS = 60 # 60 seconds
2424
CLOCK_SKEW = datetime.timedelta(seconds=CLOCK_SKEW_SECS)
2525

2626

packages/google-auth/google/auth/jwt.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,11 @@ def _verify_iat_and_exp(payload):
190190
# for clock skew.
191191
earliest = iat - _helpers.CLOCK_SKEW_SECS
192192
if now < earliest:
193-
raise ValueError("Token used too early, {} < {}".format(now, iat))
193+
raise ValueError(
194+
"Token used too early, {} < {}. Check that your computer's clock is set correctly.".format(
195+
now, iat
196+
)
197+
)
194198

195199
# Make sure the token wasn't issued in the past.
196200
exp = payload["exp"]

0 commit comments

Comments
 (0)