Skip to content

Commit

Permalink
fix(backend): Fix issue with FAPI suffixed cookies disabled (#3789)
Browse files Browse the repository at this point in the history
Co-authored-by: Nikos Douvlis <[email protected]>
Co-authored-by: Stefanos Anagnostou <[email protected]>
  • Loading branch information
3 people authored and BRKalow committed Jul 24, 2024
1 parent 7bd6b67 commit 04b15a2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/eleven-suits-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/backend": patch
---

Handle the scenario where FAPI returns unsuffixed cookies without throwing a handshake
8 changes: 8 additions & 0 deletions packages/backend/src/tokens/authenticateContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ class AuthenticateContext {
}
}

// If a suffixed session cookie exists but the corresponding client_uat cookie is missing, fallback to using
// unsuffixed cookies.
// This handles the scenario where an app has been deployed using an SDK version that supports suffixed
// cookies, but FAPI for its Clerk instance has the feature disabled (eg: if we need to temporarily disable the feature).
if (!suffixedClientUat && suffixedSession) {
return false;
}

return true;
}

Expand Down

0 comments on commit 04b15a2

Please sign in to comment.