diff --git a/@types/next-auth.d.ts b/@types/next-auth.d.ts index 43a8420..3c8a5ff 100644 --- a/@types/next-auth.d.ts +++ b/@types/next-auth.d.ts @@ -2,7 +2,7 @@ // Source : https://next-auth.js.org/getting-started/typescript#module-augmentation import type { DefaultSession, User } from "next-auth"; -declare module "next-auth" { +declare module "@auth/core/types" { interface Session { user: { id: string; diff --git a/utilities/next-auth.ts b/utilities/next-auth.ts index bc4f0a9..d86da89 100644 --- a/utilities/next-auth.ts +++ b/utilities/next-auth.ts @@ -8,6 +8,7 @@ import prisma from "@/utilities/prisma"; import Google from "@auth/core/providers/google"; import GitHub from "@auth/core/providers/github"; import Credentials from "@auth/core/providers/credentials"; +import type { Adapter } from "@auth/core/adapters"; import { PrismaAdapter } from "@auth/prisma-adapter"; import sendVerificationRequest from "@/utilities/nodemailer"; import NextAuth, { type NextAuthConfig } from "next-auth"; @@ -19,7 +20,7 @@ export const { handlers, auth, signIn, signOut } = NextAuth( { signOut: "/", verifyRequest: "/authentication?error=ValidationRequired" }, - adapter: PrismaAdapter( prisma ), + adapter: PrismaAdapter( prisma ) as Adapter, // https://github.com/nextauthjs/next-auth/issues/9493#issuecomment-1871601543 callbacks: { // Gestion des rĂ´les d'utilisateurs. // Source : https://authjs.dev/guides/basics/role-based-access-control#with-database