Skip to content

Commit a44780b

Browse files
authored
chore(clerk-js): Add comment for SameSite=Strict usage (#5781)
1 parent be1c5d6 commit a44780b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.changeset/beige-rockets-stand.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

packages/clerk-js/src/core/auth/cookies/clientUat.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ export const createClientUatCookie = (cookieSuffix: string): ClientUatCookieHand
3131

3232
const set = (client: ClientResource | undefined) => {
3333
const expires = addYears(Date.now(), 1);
34+
/*
35+
* SameSite=Strict is used here to force requests originating from a different domain to resolve the auth state.
36+
* In development, it's possible that the auth state has changed on a different domain.
37+
* Generally, this is handled by redirectWithAuth() being called and relying on the dev browser ID in the URL,
38+
* but if that isn't used we rely on this. In production, nothing is cross-domain and Lax is used when client_uat is set from FAPI.
39+
*/
3440
const sameSite = inCrossOriginIframe() ? 'None' : 'Strict';
3541
const secure = getSecureAttribute(sameSite);
3642
const domain = getCookieDomain();

0 commit comments

Comments
 (0)