Skip to content

Commit d512c59

Browse files
Merge pull request #510 from supertokens/fix/access-token-expiry
fix: update access token cookie expiry to 1 year
2 parents 07c80d9 + 486a239 commit d512c59

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## [unreleased]
1010

11+
## [0.23.0] - 2024-06-24
12+
13+
### Breaking change
14+
15+
- The access token cookie expiry has been changed from 100 years to 1 year due to some browsers capping the maximum expiry at 400 days. No action is needed on your part.
16+
1117
## [0.22.1] - 2024-06-10
1218
- Remove `user_context` being `None` check in querier delete function to make it consistent with other non GET functions
1319

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383

8484
setup(
8585
name="supertokens_python",
86-
version="0.22.1",
86+
version="0.23.0",
8787
author="SuperTokens",
8888
license="Apache 2.0",
8989
author_email="[email protected]",

supertokens_python/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from __future__ import annotations
1515

1616
SUPPORTED_CDI_VERSIONS = ["3.0"]
17-
VERSION = "0.22.1"
17+
VERSION = "0.23.0"
1818
TELEMETRY = "/telemetry"
1919
USER_COUNT = "/users/count"
2020
USER_DELETE = "/user/remove"
@@ -28,5 +28,5 @@
2828
API_VERSION = "/apiversion"
2929
API_VERSION_HEADER = "cdi-version"
3030
DASHBOARD_VERSION = "0.7"
31-
HUNDRED_YEARS_IN_MS = 3153600000000
31+
ONE_YEAR_IN_MS = 31536000000
3232
RATE_LIMIT_STATUS_CODE = 429

supertokens_python/recipe/session/cookie_and_header.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
available_token_transfer_methods,
3838
)
3939
from ...logger import log_debug_message
40-
from supertokens_python.constants import HUNDRED_YEARS_IN_MS
40+
from supertokens_python.constants import ONE_YEAR_IN_MS
4141

4242
if TYPE_CHECKING:
4343
from supertokens_python.framework.request import BaseRequest
@@ -391,11 +391,11 @@ def _set_access_token_in_response(
391391
config,
392392
"access",
393393
access_token,
394-
# We set the expiration to 100 years, because we can't really access the expiration of the refresh token everywhere we are setting it.
394+
# We set the expiration to 1 year, because we can't really access the expiration of the refresh token everywhere we are setting it.
395395
# This should be safe to do, since this is only the validity of the cookie (set here or on the frontend) but we check the expiration of the JWT anyway.
396396
# Even if the token is expired the presence of the token indicates that the user could have a valid refresh
397-
# Setting them to infinity would require special case handling on the frontend and just adding 10 years seems enough.
398-
get_timestamp_ms() + HUNDRED_YEARS_IN_MS,
397+
# Some browsers now cap the maximum expiry at 400 days, so we set it to 1 year, which should suffice.
398+
get_timestamp_ms() + ONE_YEAR_IN_MS,
399399
transfer_method,
400400
request,
401401
user_context,
@@ -410,7 +410,7 @@ def _set_access_token_in_response(
410410
config,
411411
"access",
412412
access_token,
413-
get_timestamp_ms() + HUNDRED_YEARS_IN_MS,
413+
get_timestamp_ms() + ONE_YEAR_IN_MS,
414414
"header",
415415
request,
416416
user_context,

0 commit comments

Comments
 (0)