Next.js Discord

Discord Forum

HTTP GET Error w/h NextAuth

Unanswered
Silver carp posted this in #help-forum
Open in Discord
Silver carpOP
My route.ts below, new to TS so excuse if it's something very obvious.
src/app/api/auth/[...nextauth]/route.ts

require('dotenv').config();
import NextAuth from 'next-auth';
import DiscordProvider from 'next-auth/providers/discord';

if (!process.env.DISCORD_CLIENT_ID || !process.env.DISCORD_CLIENT_SECRET) {
  throw new Error('Missing Discord Client ID or Secret');
}

const handler = NextAuth({
  providers: [
    DiscordProvider({
      clientId: process.env.DISCORD_CLIENT_ID,
      clientSecret: process.env.DISCORD_CLIENT_SECRET,
    }),
  ],
});

export { handler as GET, handler as POST };

0 Replies