-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathauth.ts
40 lines (35 loc) · 1 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
40
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { db } from "./db";
export const auth = betterAuth({
baseURL: process.env.VITE_BASE_URL,
database: drizzleAdapter(db, {
provider: "pg",
}),
// 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: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
},
google: {
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
},
discord: {
clientId: process.env.DISCORD_CLIENT_ID!,
clientSecret: process.env.DISCORD_CLIENT_SECRET!,
},
},
// https://www.better-auth.com/docs/authentication/email-password
// emailAndPassword: {
// enabled: true,
// },
});