mediahub-fe/lib/auth.ts

49 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-12-24 12:55:28 +00:00
// import NextAuth from "next-auth";
// import GitHub from "next-auth/providers/github";
// import Google from "next-auth/providers/google";
2024-11-26 03:09:48 +00:00
2024-12-24 12:55:28 +00:00
// import CredentialsProvider from "next-auth/providers/credentials";
// import { getUserByEmail, type User } from "./data";
2024-11-26 03:09:48 +00:00
2024-12-24 12:55:28 +00:00
// export const { auth, handlers, signIn, signOut } = NextAuth({
2024-11-26 03:09:48 +00:00
2024-12-24 12:55:28 +00:00
// session: {
// strategy: "jwt",
// },
// providers: [
// Google,
// GitHub,
// CredentialsProvider({
// credentials: {
2024-11-26 03:09:48 +00:00
2024-12-24 12:55:28 +00:00
// email: {},
// password: {},
// },
// async authorize(credentials) {
// if (credentials === null) return null;
2024-11-26 03:09:48 +00:00
2024-12-24 12:55:28 +00:00
// try {
// const user = getUserByEmail(credentials?.email as string);
// if (user) {
// const isMatch = user?.password === credentials.password;
2024-11-26 03:09:48 +00:00
2024-12-24 12:55:28 +00:00
// if (isMatch) {
// return user;
// } else {
// throw new Error("Email or Password is not correct");
// }
// } else {
// throw new Error("User not found");
// }
// } catch (error) {
// throw new Error(error as string);
// }
// },
// }),
2024-11-26 03:09:48 +00:00
2024-12-24 12:55:28 +00:00
// ],
// });