@@ -454,6 +454,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.session.cookie_and_head
454
454
# resulting in an infinite refresh loop. To fix this, users are asked to specify "older_cookie_domain" in
455
455
# the config.
456
456
457
+
457
458
# This function checks for multiple cookies with the same name and clears the cookies for the older domain.
458
459
def clear_session_cookies_from_older_cookie_domain(
459
460
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
491
492
get_cookie_name_from_token_type(token_type),
492
493
"",
493
494
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
+ ),
497
500
request,
498
501
domain=config.older_cookie_domain,
499
502
)
@@ -526,7 +529,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.session.cookie_and_head
526
529
for cookie_pair in cookie_pairs:
527
530
name_value = cookie_pair.split("=")
528
531
if len(name_value) != 2:
529
- raise Exception("Invalid cookie string in request header")
532
+ continue
530
533
name, value = unquote(name_value[0].strip()), unquote(name_value[1].strip())
531
534
if name in cookies:
532
535
cookies[name].append(value)
@@ -659,9 +662,11 @@ <h2 class="section-title" id="header-functions">Functions</h2>
659
662
get_cookie_name_from_token_type(token_type),
660
663
"",
661
664
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
+ ),
665
670
request,
666
671
domain=config.older_cookie_domain,
667
672
)
0 commit comments