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/clear-forks-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/backend': patch
---

Fix a case where handshakes would get triggered in a loop on cross origin requests in development.
3 changes: 2 additions & 1 deletion packages/backend/src/tokens/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,8 @@ export const authenticateRequest: AuthenticateRequest = (async (
!authenticateContext.isSatellite && // We're on primary
authenticateContext.secFetchDest === 'document' && // Document navigation
authenticateContext.isCrossOriginReferrer() && // Came from different domain
!authenticateContext.isKnownClerkReferrer(); // Not from Clerk accounts portal or FAPI
!authenticateContext.isKnownClerkReferrer() && // Not from Clerk accounts portal or FAPI
authenticateContext.handshakeRedirectLoopCounter === 0; // Not in a redirect loop

if (shouldForceHandshakeForCrossDomain) {
return handleMaybeHandshakeStatus(
Expand Down
Loading