#Next Auth Discord

11 messages · Page 1 of 1 (latest)

pine elbow
#

I keep getting https://next-auth.js.org/errors#oauth_callback_error invalid_client, when I try to login with discord on next auth... My github login is no problem.
redirectUrl = http://localhost:3000/api/auth/callback/discord

const authOptions: NextAuthOptions = {
    secret: process.env.NEXTAUTH_SECRET,
    providers: [
        GithubProvider({
            clientId: process.env.GITHUB_APP_CLIENT_ID as string,
            clientSecret: process.env.GITHUB_APP_CLIENT_SECRET as string,
        }),
        DiscordProvider({
            clientId: process.env.DISCORD_APP_CLIENT_ID as string,
            clientSecret: process.env.DISCORD_APP_CLIENT_SECRET as string
        })
    ],
    session: {
        maxAge: 24 * 3600, 
    },
};

This is a list of errors output from NextAuth.js.

light waspBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

      🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>

      ✅ You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
      (if you don't see the option, try refreshing Discord with Ctrl + R)
brave wraith
#

Hi @pine elbow, I have the same problem currently. Have you found a solution with your Discord authentication ?

pine elbow
#

Nah

misty isle
#

is your client secret valid?

pine elbow
#

Mine was

compact urchin
#

see the example, and double check your settings

patent pendant
#

I also had an issue and it turned out that I had an invalid callback URL.

What worked for me is to set the redirect to:
http://localhost:3000/api/auth/callback/discord
and also modify the "Default Authorization Link" to "Custom URL" and also paste the link there.

brave wraith
# pine elbow Nah

I found my solution ! Turns out even when I only needed the guilds scope, I also had to add the Identify scope. Then the error just stopped popping

pine elbow