Skip to content

Commit 233f2bc

Browse files
committed
more fixes
1 parent d5e35ee commit 233f2bc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

supertokens_python/recipe/session/recipe_implementation.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ async def get_session(
182182
user_context: Optional[Dict[str, Any]] = None,
183183
) -> Optional[SessionContainer]:
184184
if (
185-
anti_csrf_check is not False
186-
and self.config.anti_csrf_function_or_string
187-
== "VIA_CUSTOM_HEADER" # TODO: add case when this is a function
185+
anti_csrf_check is not False and
186+
isinstance(self.config.anti_csrf_function_or_string, str) and
187+
self.config.anti_csrf_function_or_string == "VIA_CUSTOM_HEADER"
188188
):
189189
raise Exception(
190190
"Since the anti-csrf mode is VIA_CUSTOM_HEADER getSession can't check the CSRF token. Please either use VIA_TOKEN or set anti_csrf_check to false"
@@ -283,6 +283,7 @@ async def refresh_session(
283283
) -> SessionContainer:
284284
if (
285285
disable_anti_csrf is not True
286+
and isinstance(self.config.anti_csrf_function_or_string, str)
286287
and self.config.anti_csrf_function_or_string == "VIA_CUSTOM_HEADER"
287288
):
288289
raise Exception(

0 commit comments

Comments
 (0)