feat: enhance middleware and authentication handling by adding health check route, improving session cookie security, and logging for debugging

This commit is contained in:
Julien Froidefond
2025-10-16 23:32:33 +02:00
parent 0c66fae916
commit 57a1cb5e46
3 changed files with 24 additions and 3 deletions

View File

@@ -57,5 +57,19 @@ export const { handlers, auth, signIn, signOut } = NextAuth({
session: {
strategy: "jwt",
},
cookies: {
sessionToken: {
name: process.env.NODE_ENV === "production"
? `__Secure-next-auth.session-token`
: `next-auth.session-token`,
options: {
httpOnly: true,
sameSite: "lax",
path: "/",
secure: process.env.NODE_ENV === "production",
},
},
},
secret: process.env.NEXTAUTH_SECRET,
trustHost: true,
});