Next.js Discord

Discord Forum

Next Auth isnt working anymore

Unanswered
Tonkinese posted this in #help-forum
Open in Discord
TonkineseOP
auth.ts
import DiscordProvider from "next-auth/providers/discord";
import { PrismaAdapter } from "@auth/prisma-adapter";
import { prisma } from "@lib/server/Modules";
import NextAuth from "next-auth";

export const {
  handlers: { GET, POST },
  auth,
} = NextAuth({
  providers: [
    DiscordProvider({
      authorization:
        "https://discord.com/api/oauth2/authorize?scope=identify+email+guilds",
      clientId: process.env.DISCORD_CLIENT_ID as any,
      clientSecret: process.env.DISCORD_CLIENT_SECRET as any,
    }),
  ],
  adapter: PrismaAdapter(prisma) as any,
});


api/auth/[...nextauth]/route.ts
export { GET, POST } from "@/auth";


Error:
challenge {
  scheme: 'basic',
  parameters: { error: 'invalid_client', error_description: '' }
}
[auth][error] CallbackRouteError: Read more at https://errors.authjs.dev#callbackrouteerror
[auth][cause]: Error: TODO: Handle www-authenticate challenges as needed
    at handleOAuth (webpack-internal:///(rsc)/./node_modules/next-auth/node_modules/@auth/core/lib/actions/callback/oauth/callback.js:71:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Module.callback (webpack-internal:///(rsc)/./node_modules/next-auth/node_modules/@auth/core/lib/actions/callback/index.js:33:41)
    at async AuthInternal (webpack-internal:///(rsc)/./node_modules/next-auth/node_modules/@auth/core/lib/index.js:42:24)
    at async Auth (webpack-internal:///(rsc)/./node_modules/next-auth/node_modules/@auth/core/index.js:123:29)
    at async C:\Users\mypath\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:63251
[auth][details]: {
  "provider": "discord"
}

0 Replies