mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-09-11 11:25:35 -04:00
28 lines
818 B
TypeScript
28 lines
818 B
TypeScript
import { drizzleAdapter } from "@better-auth/drizzle-adapter/relations-v2";
|
|
import { type BetterAuthOptions, betterAuth } from "better-auth/minimal";
|
|
import { nextCookies } from "better-auth/next-js";
|
|
|
|
import { db } from "@/lib/db";
|
|
import * as schema from "@/lib/db/schema";
|
|
|
|
export const auth = betterAuth({
|
|
baseURL: process.env.NEXT_PUBLIC_BASE_URL,
|
|
database: drizzleAdapter(db, {
|
|
provider: "pg",
|
|
schema,
|
|
}),
|
|
plugins: [nextCookies()],
|
|
socialProviders: {
|
|
github: {
|
|
clientId: process.env.AUTH_GITHUB_CLIENT_ID!,
|
|
clientSecret: process.env.AUTH_GITHUB_CLIENT_SECRET!,
|
|
mapProfileToUser: (profile) => ({
|
|
name: profile.login,
|
|
email: profile.email,
|
|
emailVerified: true,
|
|
image: profile.avatar_url,
|
|
}),
|
|
},
|
|
},
|
|
} satisfies BetterAuthOptions);
|