Portfolio/Websites/jefes-nextjs/app/api/auth/[...nextauth]/route.ts
2023-12-05 23:45:47 -08:00

30 lines
962 B
TypeScript

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 <input> 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 };