api/auth/providers error 500
Unanswered
miltone posted this in #help-forum
miltoneOP
How can I debug this error please ?
import NextAuth from 'next-auth';
import CredentialsProvider from 'next-auth/providers/credentials';
const handler = NextAuth({
session: {
strategy: 'jwt',
},
pages: {
signIn: '/login',
},
providers: [
CredentialsProvider({
id: "credentials",
type: "credentials",
name: "credentials",
credentials: {
email: { label: 'Email', type: 'email' },
password: { label: 'Password', type: 'password' },
},
async authorize(credentials, req) {
console.log('============================= AUTHORIZE route.ts ======================')
console.log("credentials:", credentials); // Log the credentials
console.log("req:", req); // Log the request object
// const user = { id: "1", name: "J Smith", email: "jsmith@example.com" }
//
// const passwordCorrect = false;
//
// if (passwordCorrect) {
// return {
// id: user.id,
// email: user.email,
// };
// }
return null;
},
}),
],
callbacks: {
async signIn({ user, account, profile, email, credentials }) {
console.log('route.ts -> callbacks signIn')
return true
},
async redirect({ url, baseUrl }) {
return baseUrl
},
async session({ session, user, token }) {
return session
},
async jwt({ token, user, account, profile, isNewUser }) {
return token
}
}
});
export { handler as GET, handler as POST };