chore(auth): add trustedOrigins to allow localhost in dev without impacting production

This commit is contained in:
Esdras Renan 2025-10-10 09:46:45 -03:00
parent ab820ddeca
commit 2877f22dfb

View file

@ -8,6 +8,17 @@ import { prisma } from "./prisma"
export const auth = betterAuth({
secret: env.BETTER_AUTH_SECRET,
baseURL: env.BETTER_AUTH_URL,
// Permite login tanto no domínio de produção quanto no localhost em DEV
trustedOrigins: Array.from(
new Set(
[
env.BETTER_AUTH_URL,
env.NEXT_PUBLIC_APP_URL,
process.env.NODE_ENV !== "production" ? "http://localhost:3000" : undefined,
process.env.NODE_ENV !== "production" ? "http://127.0.0.1:3000" : undefined,
].filter(Boolean) as string[]
)
),
database: prismaAdapter(prisma, {
provider: "sqlite",
}),