feat: enhance middleware and authentication handling by adding health check route, improving session cookie security, and logging for debugging
This commit is contained in:
@@ -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,
|
||||
});
|
||||
@@ -8,6 +8,8 @@ export async function getAuthSession(request: NextRequest) {
|
||||
secret: process.env.NEXTAUTH_SECRET
|
||||
});
|
||||
|
||||
console.log(`[getAuthSession] Token exists: ${!!token}, Secret configured: ${!!process.env.NEXTAUTH_SECRET}`);
|
||||
|
||||
if (!token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user