Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chilly-crews-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-js': patch
---

Update cookie setting to ensure cookies can be set to be read when an application is embedded in an iframe.
8 changes: 4 additions & 4 deletions packages/clerk-js/src/utils/cookies/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export const createCookieHandler = () => {

const setClientUatCookie = (client: ClientResource | undefined) => {
const expires = addYears(Date.now(), 1);
const sameSite = 'Strict';
const secure = false;
const sameSite = inSecureCrossOriginIframe() ? IFRAME_SAME_SITE : DEFAULT_SAME_SITE;
const secure = inSecureCrossOriginIframe() || window.location.protocol === 'https:';

// '0' indicates the user is signed out
let val = '0';
Expand All @@ -67,8 +67,8 @@ export const createCookieHandler = () => {

const setDevBrowserCookie = (jwt: string) => {
const expires = addYears(Date.now(), 1);
const sameSite = DEFAULT_SAME_SITE;
const secure = false;
const sameSite = inSecureCrossOriginIframe() ? IFRAME_SAME_SITE : DEFAULT_SAME_SITE;
const secure = inSecureCrossOriginIframe() || window.location.protocol === 'https:';

return devBrowserCookie.set(jwt, {
expires,
Expand Down