Skip to content
Discussion options

You must be logged in to vote

Yes, totally!

export default async function nextAuthHandler(req, res) {
  return NextAuth(req, res, {
    providers: [
      Providers.GitHub({
        clientId: process.env.GITHUB_ID,
        clientSecret: process.env.GITHUB_SECRET
      }),
    ],
    database: await getDatabaseConnection(),
  })
}

At the end of the day, NextAuth is just a nice wrapper for a Next.js API route handler 🙂

The currently advertised way was introduced in #868

but you probably have seen many tutorials/people still doing:

export default (req, res) => NextAuth(req, res, options)

The new way is just easier on the eye in my opinion, so I try to use it whenever possible.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@italodeandra
Comment options

@balazsorban44
Comment options

@italodeandra
Comment options

Answer selected by balazsorban44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants