Merge branch 'develop' into fix/auth-frontend-remediation
Some checks failed
Some checks failed
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { betterAuth } from "better-auth";
|
||||
import { prismaAdapter } from "better-auth/adapters/prisma";
|
||||
import { genericOAuth } from "better-auth/plugins";
|
||||
@@ -216,6 +217,7 @@ export function createAuth(prisma: PrismaClient) {
|
||||
updateAge: 60 * 60 * 2, // 2 hours — minimum session age before BetterAuth refreshes the expiry on next request
|
||||
},
|
||||
advanced: {
|
||||
generateId: () => randomUUID(),
|
||||
defaultCookieAttributes: {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === "production",
|
||||
|
||||
@@ -49,8 +49,10 @@ async function bootstrap() {
|
||||
|
||||
// Configure CORS for cookie-based authentication
|
||||
// Origin list is shared with BetterAuth trustedOrigins via getTrustedOrigins()
|
||||
const trustedOrigins = getTrustedOrigins();
|
||||
console.log(`[CORS] Trusted origins: ${JSON.stringify(trustedOrigins)}`);
|
||||
app.enableCors({
|
||||
origin: getTrustedOrigins(),
|
||||
origin: trustedOrigins,
|
||||
credentials: true, // Required for cookie-based authentication
|
||||
methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
|
||||
allowedHeaders: ["Content-Type", "Authorization", "Cookie", "X-CSRF-Token", "X-Workspace-Id"],
|
||||
|
||||
Reference in New Issue
Block a user