Skip to content

Commit

Permalink
Merge branch '0.12' into fix/authreact-test-0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhpoddar authored Sep 7, 2023
2 parents 9a6ba4b + e20bcf9 commit 02380e3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,16 @@ <h1 class="title">Module <code>supertokens_python.recipe.session.with_jwt.recipe
if decoded_payload is None or decoded_payload.get(&#34;exp&#34;) is None:
raise Exception(&#34;Error reading JWT from session&#34;)

jwt_expiry = 1
if &#34;exp&#34; in decoded_payload:
exp = decoded_payload[&#34;exp&#34;]
if exp &gt; current_time_in_seconds:
# it can come here if someone calls this function well after
# the access token and the jwt payload have expired. In this case,
# we still want the jwt payload to update, but the resulting JWT should
# not be alive for too long (since it&#39;s expired already). So we set it to
# 1 second lifetime.
jwt_expiry = exp - current_time_in_seconds
jwt_expiry = decoded_payload.get(&#34;exp&#34;, 0) - current_time_in_seconds
# pylint: disable=consider-using-max-builtin
if jwt_expiry &lt; 1:
# it can come here if someone calls this function well after
# the access token and the jwt payload have expired. In this case,
# we still want the jwt payload to update, but the resulting JWT should
# not be alive for too long (since it&#39;s expired already). So we set it to
# 1 second lifetime.
jwt_expiry = 1
# pylint: enable=consider-using-max-builtin

new_access_token_payload = await add_jwt_to_access_token_payload(
access_token_payload=new_access_token_payload,
Expand Down Expand Up @@ -405,16 +405,16 @@ <h2 class="section-title" id="header-functions">Functions</h2>
if decoded_payload is None or decoded_payload.get(&#34;exp&#34;) is None:
raise Exception(&#34;Error reading JWT from session&#34;)

jwt_expiry = 1
if &#34;exp&#34; in decoded_payload:
exp = decoded_payload[&#34;exp&#34;]
if exp &gt; current_time_in_seconds:
# it can come here if someone calls this function well after
# the access token and the jwt payload have expired. In this case,
# we still want the jwt payload to update, but the resulting JWT should
# not be alive for too long (since it&#39;s expired already). So we set it to
# 1 second lifetime.
jwt_expiry = exp - current_time_in_seconds
jwt_expiry = decoded_payload.get(&#34;exp&#34;, 0) - current_time_in_seconds
# pylint: disable=consider-using-max-builtin
if jwt_expiry &lt; 1:
# it can come here if someone calls this function well after
# the access token and the jwt payload have expired. In this case,
# we still want the jwt payload to update, but the resulting JWT should
# not be alive for too long (since it&#39;s expired already). So we set it to
# 1 second lifetime.
jwt_expiry = 1
# pylint: enable=consider-using-max-builtin

new_access_token_payload = await add_jwt_to_access_token_payload(
access_token_payload=new_access_token_payload,
Expand Down
40 changes: 20 additions & 20 deletions html/supertokens_python/recipe/session/with_jwt/session_class.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ <h1 class="title">Module <code>supertokens_python.recipe.session.with_jwt.sessio
if decoded_payload is None or decoded_payload.get(&#34;exp&#34;) is None:
raise Exception(&#34;Error reading JWT from session&#34;)

jwt_expiry = 1
if &#34;exp&#34; in decoded_payload:
exp = decoded_payload[&#34;exp&#34;]
if exp &gt; current_time_in_seconds:
# it can come here if someone calls this function well after
# the access token and the jwt payload have expired. In this case,
# we still want the jwt payload to update, but the resulting JWT should
# not be alive for too long (since it&#39;s expired already). So we set it to
# 1 second lifetime.
jwt_expiry = exp - current_time_in_seconds
jwt_expiry = decoded_payload.get(&#34;exp&#34;, 0) - current_time_in_seconds
# pylint: disable=consider-using-max-builtin
if jwt_expiry &lt; 1:
# it can come here if someone calls this function well after
# the access token and the jwt payload have expired. In this case,
# we still want the jwt payload to update, but the resulting JWT should
# not be alive for too long (since it&#39;s expired already). So we set it to
# 1 second lifetime.
jwt_expiry = 1
# pylint: enable=consider-using-max-builtin

new_access_token_payload = await add_jwt_to_access_token_payload(
access_token_payload=new_access_token_payload,
Expand Down Expand Up @@ -179,16 +179,16 @@ <h2 class="section-title" id="header-functions">Functions</h2>
if decoded_payload is None or decoded_payload.get(&#34;exp&#34;) is None:
raise Exception(&#34;Error reading JWT from session&#34;)

jwt_expiry = 1
if &#34;exp&#34; in decoded_payload:
exp = decoded_payload[&#34;exp&#34;]
if exp &gt; current_time_in_seconds:
# it can come here if someone calls this function well after
# the access token and the jwt payload have expired. In this case,
# we still want the jwt payload to update, but the resulting JWT should
# not be alive for too long (since it&#39;s expired already). So we set it to
# 1 second lifetime.
jwt_expiry = exp - current_time_in_seconds
jwt_expiry = decoded_payload.get(&#34;exp&#34;, 0) - current_time_in_seconds
# pylint: disable=consider-using-max-builtin
if jwt_expiry &lt; 1:
# it can come here if someone calls this function well after
# the access token and the jwt payload have expired. In this case,
# we still want the jwt payload to update, but the resulting JWT should
# not be alive for too long (since it&#39;s expired already). So we set it to
# 1 second lifetime.
jwt_expiry = 1
# pylint: enable=consider-using-max-builtin

new_access_token_payload = await add_jwt_to_access_token_payload(
access_token_payload=new_access_token_payload,
Expand Down

0 comments on commit 02380e3

Please sign in to comment.