mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-28 05:25:33 +00:00
29 lines
654 B
TypeScript
29 lines
654 B
TypeScript
import NextAuth, { NextAuthResult } from "next-auth";
|
|
import Google from "next-auth/providers/google";
|
|
import { DrizzleAdapter } from "@auth/drizzle-adapter";
|
|
import { db } from "./db";
|
|
|
|
export const {
|
|
handlers: { GET, POST },
|
|
signIn,
|
|
signOut,
|
|
auth,
|
|
} = NextAuth({
|
|
secret: process.env.BACKEND_SECURITY_KEY,
|
|
callbacks: {
|
|
session: ({ session, token, user }) => ({
|
|
...session,
|
|
user: {
|
|
...session.user,
|
|
id: user.id,
|
|
},
|
|
}),
|
|
},
|
|
adapter: DrizzleAdapter(db),
|
|
providers: [
|
|
Google({
|
|
clientId: process.env.GOOGLE_CLIENT_ID,
|
|
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
|
|
}),
|
|
],
|
|
});
|