@@ -454,6 +454,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.session.cookie_and_head
454454# resulting in an infinite refresh loop. To fix this, users are asked to specify "older_cookie_domain" in
455455# the config.
456456
457+
457458# This function checks for multiple cookies with the same name and clears the cookies for the older domain.
458459def clear_session_cookies_from_older_cookie_domain(
459460 request: BaseRequest, config: SessionConfig, user_context: Dict[str, Any]
@@ -491,9 +492,11 @@ <h1 class="title">Module <code>supertokens_python.recipe.session.cookie_and_head
491492 get_cookie_name_from_token_type(token_type),
492493 "",
493494 0,
494- "refresh_token_path"
495- if token_type == "refresh"
496- else "access_token_path",
495+ (
496+ "refresh_token_path"
497+ if token_type == "refresh"
498+ else "access_token_path"
499+ ),
497500 request,
498501 domain=config.older_cookie_domain,
499502 )
@@ -526,7 +529,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.session.cookie_and_head
526529 for cookie_pair in cookie_pairs:
527530 name_value = cookie_pair.split("=")
528531 if len(name_value) != 2:
529- raise Exception("Invalid cookie string in request header")
532+ continue
530533 name, value = unquote(name_value[0].strip()), unquote(name_value[1].strip())
531534 if name in cookies:
532535 cookies[name].append(value)
@@ -659,9 +662,11 @@ <h2 class="section-title" id="header-functions">Functions</h2>
659662 get_cookie_name_from_token_type(token_type),
660663 "",
661664 0,
662- "refresh_token_path"
663- if token_type == "refresh"
664- else "access_token_path",
665+ (
666+ "refresh_token_path"
667+ if token_type == "refresh"
668+ else "access_token_path"
669+ ),
665670 request,
666671 domain=config.older_cookie_domain,
667672 )
0 commit comments