File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
supertokens_python/recipe/session/with_jwt Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -159,16 +159,14 @@ async def jwt_aware_update_access_token_payload(
159159 if decoded_payload is None or decoded_payload .get ("exp" ) is None :
160160 raise Exception ("Error reading JWT from session" )
161161
162- jwt_expiry = 1
163- if "exp" in decoded_payload :
164- exp = decoded_payload ["exp" ]
165- if exp > current_time_in_seconds :
166- # it can come here if someone calls this function well after
167- # the access token and the jwt payload have expired. In this case,
168- # we still want the jwt payload to update, but the resulting JWT should
169- # not be alive for too long (since it's expired already). So we set it to
170- # 1 second lifetime.
171- jwt_expiry = exp - current_time_in_seconds
162+ jwt_expiry = decoded_payload .get ("exp" , 0 ) - current_time_in_seconds
163+ if jwt_expiry < 1 :
164+ # it can come here if someone calls this function well after
165+ # the access token and the jwt payload have expired. In this case,
166+ # we still want the jwt payload to update, but the resulting JWT should
167+ # not be alive for too long (since it's expired already). So we set it to
168+ # 1 second lifetime.
169+ jwt_expiry = 1
172170
173171 new_access_token_payload = await add_jwt_to_access_token_payload (
174172 access_token_payload = new_access_token_payload ,
You can’t perform that action at this time.
0 commit comments