import NextAuth from "next-auth"; import CredentialsProvider from "next-auth/providers/credentials"; import { compare } from "bcrypt"; import mysql from 'mysql2/promise'; const handler = NextAuth({ providers: [ CredentialsProvider({ // The name to display on the sign in form (e.g. "Sign in with...") name: "Credentials", // `credentials` is used to generate a form on the sign in page. // You can specify which fields should be submitted, by adding keys to the `credentials` object. // e.g. domain, username, password, 2FA token, etc. // You can pass any HTML attribute to the tag through the object. credentials: { email: {}, password: {}, }, async authorize(credentials, req) { // compare hashed password with password entered console.log({ credentials }); return null; }, }), ], }); export { handler as GET, handler as POST };