From 06a50b69876faebc476cbd3788e57b87e621fe29 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Mon, 11 Dec 2023 13:53:08 +0100 Subject: [PATCH] Bump auth cookie expiry --- server/http_server.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/http_server.ts b/server/http_server.ts index 659867e..4d00ec8 100644 --- a/server/http_server.ts +++ b/server/http_server.ts @@ -276,7 +276,9 @@ export class HttpServer { authCookieName(host), jwt, { - expires: new Date(Date.now() + authenticationExpirySeconds), // in a week + expires: new Date( + Date.now() + authenticationExpirySeconds * 1000, + ), // in a week sameSite: "strict", }, ); @@ -305,6 +307,7 @@ export class HttpServer { if (!excludedPaths.includes(request.url.pathname)) { const authCookie = await cookies.get(authCookieName(host)); if (!authCookie) { + console.log("Unauthorized access, redirecting to auth page"); return response.redirect("/.auth"); } const [expectedUser] = spaceServer.auth!.split(