initial commit
This commit is contained in:
34
packages/auth/src/index.ts
Normal file
34
packages/auth/src/index.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { expo } from "@better-auth/expo";
|
||||
import { db } from "@haushaltsApp/db";
|
||||
import * as schema from "@haushaltsApp/db/schema/auth";
|
||||
import { env } from "@haushaltsApp/env/server";
|
||||
import { betterAuth } from "better-auth";
|
||||
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
||||
|
||||
export const auth = betterAuth({
|
||||
database: drizzleAdapter(db, {
|
||||
provider: "pg",
|
||||
|
||||
schema: schema,
|
||||
}),
|
||||
trustedOrigins: [
|
||||
env.CORS_ORIGIN,
|
||||
"haushaltsApp://",
|
||||
...(env.NODE_ENV === "development"
|
||||
? ["exp://", "exp://**", "exp://192.168.*.*:*/**", "http://localhost:8081"]
|
||||
: []),
|
||||
],
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
},
|
||||
secret: env.BETTER_AUTH_SECRET,
|
||||
baseURL: env.BETTER_AUTH_URL,
|
||||
advanced: {
|
||||
defaultCookieAttributes: {
|
||||
sameSite: "none",
|
||||
secure: true,
|
||||
httpOnly: true,
|
||||
},
|
||||
},
|
||||
plugins: [expo()],
|
||||
});
|
||||
Reference in New Issue
Block a user