Skip to content

Commit 2d07c5e

Browse files
committed
more fixes
1 parent 391df9e commit 2d07c5e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

supertokens_python/recipe/session/session_request_functions.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ async def create_new_session_in_request(
274274
or is_an_ip_address(app_info.top_level_api_domain)
275275
)
276276
and (
277-
app_info.top_level_website_domain(request, user_context) == "localhost"
277+
app_info.get_top_level_website_domain(request, user_context) == "localhost"
278278
or is_an_ip_address(
279-
app_info.top_level_website_domain(request, user_context)
279+
app_info.get_top_level_website_domain(request, user_context)
280280
)
281281
)
282282
)
@@ -404,10 +404,14 @@ async def refresh_session_in_request(
404404
disable_anti_csrf = request_transfer_method == "header"
405405
anti_csrf_token = get_anti_csrf_header(request)
406406

407+
anti_csrf = config.anti_csrf_function_or_string
408+
if callable(anti_csrf):
409+
anti_csrf = anti_csrf(request, user_context)
410+
407411
if (
408-
config.anti_csrf_function_or_string == "VIA_CUSTOM_HEADER"
412+
anti_csrf == "VIA_CUSTOM_HEADER"
409413
and not disable_anti_csrf
410-
): # TODO: can be function
414+
):
411415
if get_rid_from_header(request) is None:
412416
log_debug_message(
413417
"refreshSession: Returning UNAUTHORISED because anti-csrf token is undefined"

0 commit comments

Comments
 (0)