File size: 726 Bytes
c35213b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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 };
|