diff --git a/.husky/commit-msg b/.husky/backup/commit-msg similarity index 100% rename from .husky/commit-msg rename to .husky/backup/commit-msg diff --git a/.husky/pre-commit b/.husky/backup/pre-commit similarity index 100% rename from .husky/pre-commit rename to .husky/backup/pre-commit diff --git a/.husky/pre-push b/.husky/backup/pre-push similarity index 100% rename from .husky/pre-push rename to .husky/backup/pre-push diff --git a/apps/app/next.config.ts b/apps/app/next.config.ts index f58c2e0c6..fb956adba 100644 --- a/apps/app/next.config.ts +++ b/apps/app/next.config.ts @@ -35,7 +35,7 @@ const config: NextConfig = { async headers() { return [ { - // Apply CORS headers to all API routes + // Super permissive CORS for all API routes source: '/api/:path*', headers: [ { @@ -50,13 +50,9 @@ const config: NextConfig = { key: 'Access-Control-Allow-Headers', value: 'Content-Type, Authorization, X-Requested-With, Accept, Origin, x-pathname', }, - { - key: 'Access-Control-Allow-Credentials', - value: 'true', - }, { key: 'Access-Control-Max-Age', - value: '86400', // 24 hours + value: '86400', }, ], }, diff --git a/apps/app/src/utils/auth-client.ts b/apps/app/src/utils/auth-client.ts index f2ff4725a..b79da5d06 100644 --- a/apps/app/src/utils/auth-client.ts +++ b/apps/app/src/utils/auth-client.ts @@ -8,6 +8,8 @@ import { createAuthClient } from 'better-auth/react'; import { auth } from './auth'; import { ac, allRoles } from './permissions'; +console.log('process.env.NEXT_PUBLIC_BETTER_AUTH_URL', process.env.NEXT_PUBLIC_BETTER_AUTH_URL); + export const authClient = createAuthClient({ baseURL: process.env.NEXT_PUBLIC_BETTER_AUTH_URL, plugins: [ diff --git a/apps/app/src/utils/auth.ts b/apps/app/src/utils/auth.ts index 0a4fa825f..558d6cdac 100644 --- a/apps/app/src/utils/auth.ts +++ b/apps/app/src/utils/auth.ts @@ -41,17 +41,19 @@ if (env.AUTH_GITHUB_ID && env.AUTH_GITHUB_SECRET) { }; } +console.log('process.env.BETTER_AUTH_URL', process.env.BETTER_AUTH_URL); + export const auth = betterAuth({ database: prismaAdapter(db, { provider: 'postgresql', }), baseURL: process.env.BETTER_AUTH_URL, trustedOrigins: [ - 'http://localhost:3000', + // 'http://localhost:3000', 'https://app.trycomp.ai', - 'https://app.staging.trycomp.ai', - 'https://portal.trycomp.ai', - 'https://portal.staging.trycomp.ai', + // 'https://app.staging.trycomp.ai', + // 'https://portal.trycomp.ai', + // 'https://portal.staging.trycomp.ai', ], emailAndPassword: { enabled: true, diff --git a/apps/portal/src/app/lib/auth-client.ts b/apps/portal/src/app/lib/auth-client.ts index 9ed8407be..9bdbc9b1c 100644 --- a/apps/portal/src/app/lib/auth-client.ts +++ b/apps/portal/src/app/lib/auth-client.ts @@ -6,6 +6,8 @@ import { import { createAuthClient } from 'better-auth/react'; import { auth } from './auth'; +console.log('process.env.NEXT_PUBLIC_BETTER_AUTH_URL', process.env.NEXT_PUBLIC_BETTER_AUTH_URL); + export const authClient = createAuthClient({ baseURL: process.env.NEXT_PUBLIC_BETTER_AUTH_URL, plugins: [organizationClient(), inferAdditionalFields(), emailOTPClient()], diff --git a/apps/portal/src/app/lib/auth.ts b/apps/portal/src/app/lib/auth.ts index 856762fed..691803324 100644 --- a/apps/portal/src/app/lib/auth.ts +++ b/apps/portal/src/app/lib/auth.ts @@ -16,19 +16,24 @@ export const auth = betterAuth({ generateId: false, }, trustedOrigins: [ - 'http://localhost:3000', + // 'http://localhost:3000', 'https://app.trycomp.ai', - 'https://app.staging.trycomp.ai', - 'https://portal.trycomp.ai', - 'https://portal.staging.trycomp.ai', + // 'https://app.staging.trycomp.ai', + // 'https://portal.trycomp.ai', + // 'https://portal.staging.trycomp.ai', ], secret: process.env.AUTH_SECRET!, plugins: [ organization({ async sendInvitationEmail(data) { + console.log( + 'process.env.NEXT_PUBLIC_BETTER_AUTH_URL', + process.env.NEXT_PUBLIC_BETTER_AUTH_URL, + ); + const isLocalhost = process.env.NODE_ENV === 'development'; const protocol = isLocalhost ? 'http' : 'https'; - const domain = isLocalhost ? 'localhost:3000' : 'app.trycomp.ai'; + const domain = isLocalhost ? 'localhost:3000' : process.env.NEXT_PUBLIC_BETTER_AUTH_URL!; const inviteLink = `${protocol}://${domain}/invite/${data.invitation.id}`; const url = `${protocol}://${domain}/auth`;