NextAuth (Discord) only redirecting to root URL, it doesnt take me to the auth page.
Unanswered
Britannia Petite posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
Britannia PetiteOP
Self explanatory.
8 Replies
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
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
![Image](https://cdn.discordapp.com/attachments/1166788963160297552/1166789176784592997/image.png?ex=654bc419&is=65394f19&hm=a8f5c5f0bc6b326301abc121bc7e1e3ba2adf7f59f4d7fa056f67fab58040a4a&)
fyi (it doesnt even go to the discord auth page, it just refreshes my current root page)
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
Britannia PetiteOP
![Image](https://cdn.discordapp.com/attachments/1166788963160297552/1166793962363826207/image.png?ex=654bc88e&is=6539538e&hm=211c16f10255d0f5be44fac3871c7d5eddca1325149d60f17c44cdbbd13fd525&)
redirect callback is printing this