Skip to content

Commit ff88877

Browse files
committed
We did observe a test failure caused by clock skew
1 parent 2da6f4a commit ff88877

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

oauth2cli/oidc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ def decode_id_token(id_token, client_id=None, issuer=None, nonce=None, now=None)
3939
decoded = json.loads(decode_part(id_token.split('.')[1]))
4040
err = None # https://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation
4141
_now = now or time.time()
42-
if _now < decoded.get("nbf", _now - 1): # nbf is optional per JWT specs
42+
skew = 120 # 2 minutes
43+
if _now + skew < decoded.get("nbf", _now - 1): # nbf is optional per JWT specs
4344
# This is not an ID token validation, but a JWT validation
4445
# https://tools.ietf.org/html/rfc7519#section-4.1.5
4546
err = "0. The ID token is not yet valid"

0 commit comments

Comments
 (0)