import NextAuth, { AuthOptions } from "next-auth"; import DiscordProvider from "next-auth/providers/discord"; export const authOptions: AuthOptions = { providers: [ DiscordProvider({ clientId: process.env.DISCORD_CLIENT_ID as string, clientSecret: process.env.DISCORD_CLIENT_SECRET as string, }), ], callbacks: { async session({ session, token }) { if (session?.user) { // Expose the user's Discord ID to the session (session.user as any).id = token.sub; } return session; }, }, pages: { signIn: '/vip', // Redirect custom sign in if needed }, debug: true, }; const handler = NextAuth(authOptions); export { handler as GET, handler as POST };