Next.js Discord

Discord Forum

NextAuth (Discord) only redirecting to root URL, it doesnt take me to the auth page.

Unanswered
Britannia Petite posted this in #help-forum
Open in Discord
Britannia PetiteOP
Self explanatory.

8 Replies

Britannia PetiteOP
import NextAuth from "next-auth"
import DiscordProvider from "next-auth/providers/discord";
const scopes = ['identify']

export const authOptions = {
  providers: [
    DiscordProvider({
      clientId: "",
      clientSecret: "",
      authorization: {
        params: { scope: scopes.join(' ') }
      },
    
    })
  ],
  secret: process.env.NEXTAUTH_SECRET
}

const handler = NextAuth(authOptions)
export { handler as GET, handler as POST }
my code.
'use client'

import { useSession, signIn, signOut } from "next-auth/react"
import Button from "@mui/material/Button/Button"

export default function LoginButton() {
    const { data: session } = useSession()

    if (session) {
        return (<>
            <Button key={"login-button"} sx={{ color: '#fff' }} onClick={() => signIn()}>
                Logout
            </Button>
        </>)
    } else {
        return (<>
            <Button key={"login-button"} sx={{ color: '#fff' }} onClick={() => signOut()}>
                Login
            </Button>
        </>)
    }
}
any help would be appreciative
fyi (it doesnt even go to the discord auth page, it just refreshes my current root page)
Britannia PetiteOP
redirect callback is printing this