Files
vfxreview/auth.config.ts
twotalesanimation 01474084fa
Deploy / deploy (push) Successful in 2m27s
mobile support for client review player3
2026-06-12 09:49:37 +02:00

36 lines
1.1 KiB
TypeScript

import type { NextAuthConfig } from "next-auth";
import type { Role } from "@prisma/client";
/**
* Edge-safe auth config — no Prisma, no bcryptjs.
* Used by middleware (Edge Runtime) for JWT verification only.
* The full auth config (with Credentials provider + Prisma adapter) lives in auth.ts.
*/
export const authConfig: NextAuthConfig = {
session: { strategy: "jwt" },
pages: {
signIn: "/login",
},
callbacks: {
async jwt({ token, user }) {
if (user) {
token.id = user.id;
token.role = (user as { role: Role }).role;
token.mustChangePassword =
(user as { mustChangePassword?: boolean }).mustChangePassword ?? false;
}
return token;
},
async session({ session, token }) {
if (token && session.user) {
session.user.id = token.id as string;
session.user.role = token.role as Role;
session.user.mustChangePassword = token.mustChangePassword as boolean;
}
return session;
},
},
// No providers here — Credentials provider (bcryptjs) only in auth.ts
providers: [],
};