import NextAuth, { type NextAuthOptions } from 'next-auth'; import GitHubProvider from 'next-auth/providers/github'; // Prisma adapter for NextAuth, optional and can be removed import { PrismaAdapter } from '@next-auth/prisma-adapter'; import { env } from '../../../env/server.mjs'; import { prisma } from '../../../server/db/client'; export const authOptions: NextAuthOptions = { // Configure one or more authentication providers adapter: PrismaAdapter(prisma), // Include user.id on session callbacks: { session({ session, user }) { if (session.user != null) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore session.user.id = user.id; } return session; }, }, providers: [ GitHubProvider({ clientId: env.GITHUB_CLIENT_ID, clientSecret: env.GITHUB_CLIENT_SECRET, }), // ...add more providers here ], }; export default NextAuth(authOptions);