nextAuth with discord
Unanswered
Citrine Wagtail posted this in #help-forum
Citrine WagtailOP
i am trying to setup next auth for discord provider but i keep getting this session error whenever i try to login with the provider
this is the api route
this is the provider config
please help with this as i am new to the nextAuth
import NextAuth from "next-auth";
import {authOptions} from "@/lib/authOptions";
const handler = NextAuth(authOptions)
export { handler as GET, handler as POST}this is the api route
import {NextAuthOptions} from "next-auth";
import Discord from "next-auth/providers/discord";
export const authOptions: NextAuthOptions = {
providers: [
Discord({
clientId: process.env.DISCORD_CLIENT_ID,
clientSecret: process.env.DISCORD_CLIENT_SECRET,
}),
]
}this is the provider config
please help with this as i am new to the nextAuth
1 Reply
Citrine WagtailOP
import {NextAuthOptions} from "next-auth";
import Discord from "next-auth/providers/discord";
export const authOptions: NextAuthOptions = {
secret: process.env.NEXTAUTH_SECRET,
providers: [
Discord({
clientId: process.env.DISCORD_CLIENT_ID,
clientSecret: process.env.DISCORD_CLIENT_SECRET,
}),
]
}the problem here is when i start the app i am in the session but whenver i refresh the page the session gets removed and then i see the not found errors