Next.js Discord

Discord Forum

Next-auth discord help

Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
I logged in via next-auth using the code
import NextAuth from "next-auth/next";
import DiscordProvider from "next-auth/providers/discord";

const authOptions = {
    providers: [
          clientId: process.env.DISCORD_CLIENT_ID,
          clientSecret: process.env.DISCORD_CLIENT_SECRET,
          authorization: { params: { scope: 'identify guilds' } },
    callbacks: {
      async jwt({ token, account, profile }) {
        // Persist the OAuth access_token and or the user id to the token right after signin
        if (account) {
          token.accessToken = account.access_token
        return token
      async session({ session, token, user }) {
        // Send properties to the client, like an access_token and user id from a provider.
        session.accessToken = token.accessToken =
        return session

const handler = NextAuth(authOptions);

export { handler as GET, handler as POST }

And how do I display a list of user guilds on the site, namely the name of the guild, I Googled and found something, but for some reason it does not display anything. I will be grateful for your help, thank you in advance

0 Replies