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: [
TwitchProvider({
clientId: process.env.TWITCH_CLIENT_ID,
clientSecret: process.env.TWITCH_CLIENT_SECRET
})
],
secret: process.env.JWT_SECRET,
pages:{
signIn: "/login",
signOut: "/logout",
verify: "/verify",
},
callbacks: {
wellKnown: `https://id.twitch.tv/oauth2/authorize?client_id=jwk4v6qrymwe3odjf13oaif4&response_type=code&force_verify=true&scope=...callback`,
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,
email: profile.email,
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({
Component,
pageProps: { session, ...pageProps },
}) {
return (
<SessionProvider session={session}>
<Component {...pageProps} />
</SessionProvider>
)
}
When I click on the button that should log in, it takes me to the following url:
http://localhost:3000/login?callbackUrl=https://id.twitch.tv
I’ve been trying to fix it for days but I can’t, please, I appreciate all help in advance.
Thanks a lot