Problem with NextAuth and Twitch Api Auth

Hi everyone, I am trying to make a website accessible with Twitch account, for this I am using nextJs (Nextauth).

The problem is that I cannot configure the callback to direct me to the twitch auth.

I have the following:

import NextAuth from "next-auth"
import TwitchProvider from "next-auth/providers/twitch";

export default NextAuth({
  // Configure one or more authentication providers
  providers: [
      clientId: process.env.TWITCH_CLIENT_ID,
      clientSecret: process.env.TWITCH_CLIENT_SECRET
  secret: process.env.JWT_SECRET,
    signIn: "/login",
    signOut: "/logout",
    verify: "/verify",
  callbacks: {
  wellKnown: ``,
  id: "twitch",
  name: "Twitch",
  type: "oauth",
  authorization: {
    params: {
      scope: "openid user:read:email",
      claims: {
        id_token: {
          email: null,
          picture: null,
          preferred_username: null,
  idToken: true,
  profile(profile) {
    return {
      id: profile.sub,
      name: profile.preferred_username,
      image: profile.picture,

Then in _app.js I have the following:

import '../styles/globals.scss'
import { SessionProvider } from "next-auth/react"

export default function App({
  pageProps: { session, ...pageProps },
}) {
  return (
    <SessionProvider session={session}>
      <Component {...pageProps} />

When I click on the button that should log in, it takes me to the following url:


I’ve been trying to fix it for days but I can’t, please, I appreciate all help in advance.

Thanks a lot

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.