Skip to content

Commit 045fb93

Browse files
dimklnikosdouvlisanagstef
authored
fix(backend): Fix issue with FAPI suffixed cookies disabled (#3789)
Co-authored-by: Nikos Douvlis <nikosdouvlis@gmail.com> Co-authored-by: Stefanos Anagnostou <anagstef@users.noreply.github.com>
1 parent 5356e51 commit 045fb93

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.changeset/eleven-suits-flow.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/backend": patch
3+
---
4+
5+
Handle the scenario where FAPI returns unsuffixed cookies without throwing a handshake

packages/backend/src/tokens/authenticateContext.ts

+8
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,14 @@ class AuthenticateContext {
213213
}
214214
}
215215

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

0 commit comments

Comments
 (0)