Skip to content

Commit

Permalink
Added workaround for type mismatch with Next Auth and Prisma
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianLeChat committed Jan 1, 2024
1 parent efbeafc commit 23de32d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion @types/next-auth.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion utilities/next-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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
Expand Down

0 comments on commit 23de32d

Please sign in to comment.