File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
supertokens_python/recipe/session Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ async def create_new_session(
110110 access_token_payload = {}
111111 enable_anti_csrf = (
112112 disable_anti_csrf is False
113+ # We dont need to check if anti csrf is a function here because checking for "VIA_TOKEN" is enough
113114 and recipe_implementation .config .anti_csrf_function_or_string == "VIA_TOKEN"
114115 )
115116 response = await recipe_implementation .querier .send_post_request (
@@ -243,7 +244,7 @@ async def get_session(
243244 )
244245 raise_try_refresh_token_exception ("anti-csrf check failed" )
245246
246- elif config .anti_csrf_function_or_string == "VIA_CUSTOM_HEADER" :
247+ elif ( isinstance ( config .anti_csrf_function_or_string , str ) and config . anti_csrf_function_or_string == "VIA_CUSTOM_HEADER" ) :
247248 # The function should never be called by this (we check this outside the function as well)
248249 # There we can add a bit more information to the error, so that's the primary check, this is just making sure.
249250 raise Exception (
@@ -341,8 +342,7 @@ async def refresh_session(
341342 data ["antiCsrfToken" ] = anti_csrf_token
342343
343344 if (
344- recipe_implementation .config .anti_csrf_function_or_string
345- == "VIA_CUSTOM_HEADER" # TODO: can be function
345+ isinstance (recipe_implementation .config .anti_csrf_function_or_string , str ) and recipe_implementation .config .anti_csrf_function_or_string == "VIA_CUSTOM_HEADER"
346346 and not disable_anti_csrf
347347 ):
348348 # The function should never be called by this (we check this outside the function as well)
You can’t perform that action at this time.
0 commit comments