Skip to content

Commit

Permalink
fixup! chore(clerk-js): Simplify dev browser handling
Browse files Browse the repository at this point in the history
  • Loading branch information
SokratisVidros authored and tmilewski committed Dec 15, 2023
1 parent eed1381 commit b94aa40
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/clerk-js/src/core/devBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,26 @@ export function createDevBrowser({ frontendApi, fapiClient }: CreateDevBrowserOp
}
});

// 1. If a cookie already exists, it might have SameSite=Strict. Re-set it to make sure it has SameSite=Lax
// 2. If a cookie already exists, it might have SameSite=Strict. Re-set it to make sure it has SameSite=Lax
const existingDevBrowserCookie = getDevBrowserCookie();
if (existingDevBrowserCookie) {
removeDevBrowserCookie();
setDevBrowserCookie(existingDevBrowserCookie);
}

// 2. Get the JWT from hash or search parameters when the redirection comes from AP
// 3. Get the JWT from hash or search parameters when the redirection comes from AP
const devBrowserToken = getDevBrowserJWTFromURL(new URL(window.location.href));
if (devBrowserToken) {
setDevBrowserJWT(devBrowserToken);
return;
}

// 3. If no JWT is found in the first step, check if a JWT is already available in the JS cookie
// 4. If no JWT is found in the first step, check if a JWT is already available in the JS cookie
if (getDevBrowserCookie()) {
return;
}

// 4. Otherwise, fetch a new DevBrowser JWT from FAPI and cache it
// 5. Otherwise, fetch a new DevBrowser JWT from FAPI and cache it
const createDevBrowserUrl = fapiClient.buildUrl({
path: '/dev_browser',
});
Expand Down

0 comments on commit b94aa40

Please sign in to comment.