Skip to content

Commit b0d3667

Browse files
fix(auth): add crossSubDomainCookies
1 parent 4d0be24 commit b0d3667

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

backend/src/auth.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,28 @@ export const auth = betterAuth({
1616
account: SCHEMA.AUTH.accounts,
1717
session: SCHEMA.AUTH.sessions,
1818
verification: SCHEMA.AUTH.verifications,
19-
}
19+
},
2020
}),
21+
advanced: {
22+
crossSubDomainCookies: {
23+
enabled: true,
24+
domain: ".polinetwork.org", // Domain with a leading period
25+
},
26+
defaultCookieAttributes: {
27+
secure: true,
28+
httpOnly: true,
29+
sameSite: "none", // Allows CORS-based cookie sharing across subdomains
30+
partitioned: true, // New browser standards will mandate this for foreign cookies
31+
},
32+
},
2133
cookieCache: {
2234
enabled: true,
2335
maxAge: 5 * 60, // Cache duration in seconds
2436
},
25-
socialProviders: {
26-
github: {
27-
clientId: env.GITHUB_CLIENT_ID,
28-
clientSecret: env.GITHUB_CLIENT_SECRET,
29-
},
30-
},
37+
socialProviders: {
38+
github: {
39+
clientId: env.GITHUB_CLIENT_ID,
40+
clientSecret: env.GITHUB_CLIENT_SECRET,
41+
},
42+
},
3143
});

0 commit comments

Comments
 (0)