Sign in mechanism

This commit is contained in:
Timothy Armes
2024-04-09 14:04:49 +02:00
parent ce967f159d
commit 1aba39b0e9
16 changed files with 525 additions and 29 deletions
+30
View File
@@ -0,0 +1,30 @@
import { MongoDBAdapter } from "@auth/mongodb-adapter";
import NextAuth from "next-auth";
import clientPromise from "@/lib/mongodb";
import Email from "@/utils/nodemailerProvider";
export const {
handlers: { GET, POST },
auth,
} = NextAuth({
adapter: MongoDBAdapter(clientPromise, { databaseName: "userData" }),
providers: [
Email({
server: {
host: process.env.SMTP_HOST,
port: Number(process.env.SMTP_PORT),
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASSWORD,
},
},
from: process.env.EMAIL_FROM,
}),
],
pages: {
signIn: "/auth/sign-in",
},
});