Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!