Skip to content

Commit 76381ff

Browse files
committed
fix(oauth): skipStateCookieCheck flag change
1 parent 3f3efc9 commit 76381ff

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

apps/sim/lib/auth/auth.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,12 @@ export const auth = betterAuth({
687687
...SSO_TRUSTED_PROVIDERS,
688688
],
689689
},
690+
// Mothership/headless OAuth links are generated server-side via auth.api.oAuth2LinkAccount,
691+
// so better-auth's signed `state` cookie is set on the server-to-server response and never
692+
// reaches the user's browser. With the database state strategy, the callback would then fail
693+
// with state_security_mismatch (`?error=state_mismatch`). The DB verification record + PKCE
694+
// still bind the flow, so skip the additional browser-cookie check.
695+
skipStateCookieCheck: true,
690696
},
691697
socialProviders: {
692698
...(!isGithubAuthDisabled && {

0 commit comments

Comments
 (0)