import NextAuth from 'next-auth'; import { PrismaAdapter } from '@auth/prisma-adapter'; import Google from 'next-auth/providers/google'; import GitHub from 'next-auth/providers/github'; import Credentials from 'next-auth/providers/credentials'; import { db } from '@/lib/db'; export const { handlers, signIn, signOut, auth } = NextAuth({ adapter: PrismaAdapter(db), providers: [ // Google OAuth - uncomment and add credentials when ready // Google({ // clientId: process.env.GOOGLE_CLIENT_ID, // clientSecret: process.env.GOOGLE_CLIENT_SECRET, // }), // GitHub OAuth - uncomment and add credentials when ready // GitHub({ // clientId: process.env.GITHUB_ID, // clientSecret: process.env.GITHUB_SECRET, // }), // Email/Password - for development, add proper provider in production Credentials({ name: 'credentials', credentials: { email: { label: 'Email', type: 'email' }, password: { label: 'Password', type: 'password' }, }, async authorize(credentials) { // TODO: Implement proper credential validation // This is a placeholder for development if (!credentials?.email) { return null; } // In production, verify password hash here const user = await db.user.findUnique({ where: { email: credentials.email as string }, }); return user; }, }), ], session: { strategy: 'jwt', }, pages: { signIn: '/login', // signUp: '/register', // error: '/auth/error', }, callbacks: { async session({ session, token }) { if (token.sub && session.user) { session.user.id = token.sub; } return session; }, async jwt({ token, user }) { if (user) { token.sub = user.id; } return token; }, }, });