-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.ts
39 lines (33 loc) · 1.01 KB
/
auth.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { admin } from "better-auth/plugins";
import { reactStartCookies } from "better-auth/react-start";
import env from "@/env";
import { getBaseUrl } from "~/lib/utils";
import { db } from "./db";
export const auth = betterAuth({
baseURL: getBaseUrl(),
database: drizzleAdapter(db, {
provider: "pg",
}),
// https://www.better-auth.com/docs/integrations/tanstack#usage-tips
plugins: [reactStartCookies(), admin()],
// https://www.better-auth.com/docs/concepts/session-management#session-caching
session: {
cookieCache: {
enabled: true,
maxAge: 5 * 60, // 5 minutes
},
},
// https://www.better-auth.com/docs/concepts/oauth
socialProviders: {
github: {
clientId: env.GITHUB_CLIENT_ID!,
clientSecret: env.GITHUB_CLIENT_SECRET!,
},
},
// https://www.better-auth.com/docs/authentication/email-password
// emailAndPassword: {
// enabled: true,
// },
});