Skip to content
Discussion options

You must be logged in to vote

Not by default, but I believe this should work:

// /api/auth/[...nextauth].js
import NextAuth from "next-auth"
import CredentialsProvider from "next-auth/providers/credentials"
import GoogleProvider from "next-auth/providers/google"

export default async function auth(req, res) {
  const providers = [
    CredentialsProvider({
      // ...
    }),
    GoogleProvider({
      // ...
    })
  ]

  // Based on https://next-auth.js.org/getting-started/rest-api#get-apiauthsignin
  const isDefaultSigninPage = req.method === "GET" && req.query.nextauth.includes("signin")
  if (isDefaultSigninPage) providers.pop()

  return await NextAuth(req, res, {
    providers,
    // rest of your config ...
  })

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
6 replies
@balazsorban44
Comment options

@zakaryan2004
Comment options

@zakaryan2004
Comment options

@balazsorban44
Comment options

@muckee
Comment options

Answer selected by zakaryan2004
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants