mirror of
https://github.com/Fayorg/calendrier-avant.git
synced 2026-05-27 17:18:38 +02:00
add: full authentication with NextAuth
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import Credentials from "next-auth/providers/credentials";
|
||||
import prisma from "./prisma";
|
||||
import { getServerSession, RequestInternal, type NextAuthOptions, User } from "next-auth";
|
||||
import type { GetServerSidePropsContext, NextApiRequest, NextApiResponse } from "next"
|
||||
|
||||
export async function authenticate(key: string) {
|
||||
console.log("Running authenticate function with key: " + key);
|
||||
@@ -72,4 +73,9 @@ export const authOptions: NextAuthOptions = {
|
||||
],
|
||||
};
|
||||
|
||||
// Use it in server contexts
|
||||
export function auth(...args: [GetServerSidePropsContext["req"], GetServerSidePropsContext["res"]] | [NextApiRequest, NextApiResponse] | []) {
|
||||
return getServerSession(...args, authOptions)
|
||||
}
|
||||
|
||||
export const getAuthServerSession = () => getServerSession(authOptions);
|
||||
Reference in New Issue
Block a user