File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
supertokens_python/recipe/session Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff 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 (
You can’t perform that action at this time.
0 commit comments