File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
supertokens_python/recipe/session/with_jwt Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -70,16 +70,16 @@ async def update_access_token_payload(
7070 if decoded_payload is None or decoded_payload .get ("exp" ) is None :
7171 raise Exception ("Error reading JWT from session" )
7272
73- jwt_expiry = 1
74- if "exp" in decoded_payload :
75- exp = decoded_payload [ "exp" ]
76- if exp > current_time_in_seconds :
77- # it can come here if someone calls this function well after
78- # the access token and the jwt payload have expired. In this case,
79- # we still want the jwt payload to update, but the resulting JWT should
80- # not be alive for too long (since it's expired already). So we set it to
81- # 1 second lifetime.
82- jwt_expiry = exp - current_time_in_seconds
73+ jwt_expiry = decoded_payload . get ( "exp" , 0 ) - current_time_in_seconds
74+ # pylint: disable=consider-using-max-builtin
75+ if jwt_expiry < 1 :
76+ # it can come here if someone calls this function well after
77+ # the access token and the jwt payload have expired. In this case,
78+ # we still want the jwt payload to update, but the resulting JWT should
79+ # not be alive for too long (since it's expired already). So we set it to
80+ # 1 second lifetime.
81+ jwt_expiry = 1
82+ # pylint: enable=consider-using-max-builtin
8383
8484 new_access_token_payload = await add_jwt_to_access_token_payload (
8585 access_token_payload = new_access_token_payload ,
You can’t perform that action at this time.
0 commit comments