Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

155
Visualizações
Next-auth logIn() is stuck on /api/auth/providers while using Credentials provider

Next-auth logIn() is stuck endlessly on /api/auth/providers as can be seen here.

async authorize(credentials) part doesn't seem to be executed at all, as none of the console.log seem to be working

/pages/api/auth/[...nextauth].js

import Providers from 'next-auth/providers';
import connectDB from '../../../lib/connectDB';
import User from '../../../models/User';

export default NextAuth({
    //Configure JWT
    session: {
        jwt: true,
    },
    //Specify Provider
    providers: [
        Providers.Credentials({
            async authorize(credentials) {
                console.log('====THIS MESSAGE IS NOT SHOWN ON CONSOLE====')
                connectDB();
                const user = await User.findOne({
                    email: credentials.email,
                });

                console.log(user);

                if (user & (await user.matchPassword(credentials.passowrd))) {
                    client.close();
                    return { email: user.email };
                }
                client.close();
                return null;
            },
        }),
    ],
});

Client Side

  const onLogin = async (values) => {
        const status = await signIn('credentials', {
            redirect: false,
            email: values.email,
            password: values.password,
        });
        console.log('Login Status: ', status);
        // This is not logged as well, due to /api/auth/providers being stuck
  }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Could it be that yuo're not defining the fields in the credentials provider setup in [...nextauth].js ?

https://next-auth.js.org/v3/configuration/providers#how-to-2

enter image description here

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda