24 lines
613 B
TypeScript
24 lines
613 B
TypeScript
import { betterAuth } from "better-auth";
|
|
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
|
|
|
import { env } from "~/env";
|
|
import { db } from "~/server/db";
|
|
|
|
export const auth = betterAuth({
|
|
database: drizzleAdapter(db, {
|
|
provider: "sqlite", // or "pg" or "mysql"
|
|
}),
|
|
emailAndPassword: {
|
|
enabled: true,
|
|
},
|
|
socialProviders: {
|
|
github: {
|
|
clientId: env.BETTER_AUTH_GITHUB_CLIENT_ID,
|
|
clientSecret: env.BETTER_AUTH_GITHUB_CLIENT_SECRET,
|
|
redirectURI: "http://localhost:3000/api/auth/callback/github",
|
|
},
|
|
},
|
|
});
|
|
|
|
export type Session = typeof auth.$Infer.Session;
|