Skip to content

Commit f5ba6a6

Browse files
committed
fix: Failing supertokens-website frontendIntegration tests
1 parent d676c49 commit f5ba6a6

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

supertokens_python/recipe/session/with_jwt/recipe_implementation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ async def jwt_aware_update_access_token_payload(
156156
jwt=existing_jwt, options={"verify_signature": False, "verify_exp": False}
157157
)
158158

159-
if decoded_payload is None:
159+
if decoded_payload is None or decoded_payload.get("exp") is None:
160160
raise Exception("Error reading JWT from session")
161161

162162
jwt_expiry = 1

supertokens_python/recipe/session/with_jwt/session_class.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ async def update_access_token_payload(
6767
jwt=existing_jwt, options={"verify_signature": False, "verify_exp": False}
6868
)
6969

70-
if decoded_payload is None:
70+
if decoded_payload is None or decoded_payload.get("exp") is None:
7171
raise Exception("Error reading JWT from session")
7272

7373
jwt_expiry = 1

tests/frontendIntegration/django2x/mysite/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@
5151
"PUT",
5252
]
5353

54-
CORS_ALLOW_HEADERS: List[str] = list(default_headers) + [ # type: ignore
54+
CORS_ALLOW_HEADERS: List[str] = list(default_headers) + [
5555
"Content-Type",
5656
"rid",
5757
"fdi-version",
5858
"anti-csrf",
59+
"st-auth-mode",
5960
]
6061

6162
# Application definition

tests/frontendIntegration/django2x/polls/views.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
from django.http import HttpRequest, HttpResponse, JsonResponse
2222
from django.shortcuts import render
23+
from django.conf import settings
24+
from supertokens_python import get_all_cors_headers
2325
from supertokens_python import InputAppInfo, Supertokens, SupertokensConfig, init
2426
from supertokens_python.framework import BaseRequest, BaseResponse
2527
from supertokens_python.recipe import session
@@ -309,6 +311,9 @@ def config(
309311
telemetry=False,
310312
)
311313

314+
for header in get_all_cors_headers():
315+
assert header in settings.CORS_ALLOW_HEADERS
316+
312317

313318
config(True, False, None)
314319

tests/frontendIntegration/django3x/mysite/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,12 @@
5050
"PUT",
5151
]
5252

53-
CORS_ALLOW_HEADERS: List[str] = list(default_headers) + [ # type: ignore
53+
CORS_ALLOW_HEADERS: List[str] = list(default_headers) + [
5454
"Content-Type",
5555
"rid",
5656
"fdi-version",
5757
"anti-csrf",
58+
"st-auth-mode",
5859
]
5960

6061
# Application definition

tests/frontendIntegration/django3x/polls/views.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
from django.http import HttpRequest, HttpResponse, JsonResponse
2727
from django.shortcuts import render
28+
from django.conf import settings
29+
from supertokens_python import get_all_cors_headers
2830
from supertokens_python import InputAppInfo, Supertokens, SupertokensConfig, init
2931
from supertokens_python.framework import BaseRequest, BaseResponse
3032
from supertokens_python.recipe import session
@@ -316,6 +318,9 @@ def config(
316318
telemetry=False,
317319
)
318320

321+
for header in get_all_cors_headers():
322+
assert header in settings.CORS_ALLOW_HEADERS
323+
319324

320325
config(True, False, None)
321326

0 commit comments

Comments
 (0)