@@ -44,10 +44,11 @@ def decode_id_token(id_token, client_id=None, issuer=None, nonce=None, now=None)
44
44
err = None # https://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation
45
45
_now = int (now or time .time ())
46
46
skew = 120 # 2 minutes
47
+ TIME_SUGGESTION = "Make sure your computer's time is correctly synchronized."
47
48
if _now + skew < decoded .get ("nbf" , _now - 1 ): # nbf is optional per JWT specs
48
49
# This is not an ID token validation, but a JWT validation
49
50
# https://tools.ietf.org/html/rfc7519#section-4.1.5
50
- err = "0. The ID token is not yet valid."
51
+ err = "0. The ID token is not yet valid. " + TIME_SUGGESTION
51
52
if issuer and issuer != decoded ["iss" ]:
52
53
# https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationResponse
53
54
err = ('2. The Issuer Identifier for the OpenID Provider, "%s", '
@@ -68,7 +69,7 @@ def decode_id_token(id_token, client_id=None, issuer=None, nonce=None, now=None)
68
69
# the TLS server validation MAY be used to validate the issuer
69
70
# in place of checking the token signature.
70
71
if _now - skew > decoded ["exp" ]:
71
- err = "9. The current time MUST be before the time represented by the exp Claim."
72
+ err = "9. The ID token already expires. " + TIME_SUGGESTION
72
73
if nonce and nonce != decoded .get ("nonce" ):
73
74
err = ("11. Nonce must be the same value "
74
75
"as the one that was sent in the Authentication Request." )
0 commit comments