diff --git a/apps/infoalloggi/src/middlewares/auth_middleware.ts b/apps/infoalloggi/src/middlewares/auth_middleware.ts index d3f6903..60518dd 100644 --- a/apps/infoalloggi/src/middlewares/auth_middleware.ts +++ b/apps/infoalloggi/src/middlewares/auth_middleware.ts @@ -137,7 +137,7 @@ const refreshAuthToken = async ( ); response.cookies.set(TOKEN_CONFIG.ACCESS_TOKEN_COOKIE_NAME, newAccessToken, { expires: add(new Date(), { - minutes: TOKEN_CONFIG.ACCESS_TOKEN_COOKIE_EXPIRY, + hours: TOKEN_CONFIG.ACCESS_TOKEN_COOKIE_EXPIRY, }), ...TOKEN_CONFIG.COOKIE_OPTIONS, //secure: env.NODE_ENV === "production", diff --git a/apps/infoalloggi/src/server/auth/configs.ts b/apps/infoalloggi/src/server/auth/configs.ts index a2173e3..2f33d68 100644 --- a/apps/infoalloggi/src/server/auth/configs.ts +++ b/apps/infoalloggi/src/server/auth/configs.ts @@ -1,9 +1,9 @@ export const TOKEN_CONFIG = { ACCESS_TOKEN_COOKIE_NAME: "access_token", REFRESH_TOKEN_COOKIE_NAME: "refresh_token", - ACCESS_TOKEN_EXPIRY: "5m", + ACCESS_TOKEN_EXPIRY: "1h", REFRESH_TOKEN_EXPIRY: "7d", - ACCESS_TOKEN_COOKIE_EXPIRY: 5, + ACCESS_TOKEN_COOKIE_EXPIRY: 1, REFRESH_TOKEN_COOKIE_EXPIRY: 7, COOKIE_OPTIONS: { httpOnly: true, diff --git a/apps/infoalloggi/src/server/controllers/auth.controller.ts b/apps/infoalloggi/src/server/controllers/auth.controller.ts index a5fe2ca..7f6e004 100644 --- a/apps/infoalloggi/src/server/controllers/auth.controller.ts +++ b/apps/infoalloggi/src/server/controllers/auth.controller.ts @@ -143,7 +143,7 @@ export const logIn = async ({ await setCookie(TOKEN_CONFIG.ACCESS_TOKEN_COOKIE_NAME, accessToken, { ...TOKEN_CONFIG.COOKIE_OPTIONS, expires: add(new Date(), { - minutes: TOKEN_CONFIG.ACCESS_TOKEN_COOKIE_EXPIRY, + hours: TOKEN_CONFIG.ACCESS_TOKEN_COOKIE_EXPIRY, }), req, res, @@ -151,7 +151,7 @@ export const logIn = async ({ await setCookie(TOKEN_CONFIG.REFRESH_TOKEN_COOKIE_NAME, refreshToken, { ...TOKEN_CONFIG.COOKIE_OPTIONS, expires: add(new Date(), { - minutes: TOKEN_CONFIG.REFRESH_TOKEN_COOKIE_EXPIRY, + days: TOKEN_CONFIG.REFRESH_TOKEN_COOKIE_EXPIRY, }), req, res, @@ -206,7 +206,7 @@ export const swapAuth = async ({ await setCookie(TOKEN_CONFIG.ACCESS_TOKEN_COOKIE_NAME, accessToken, { ...TOKEN_CONFIG.COOKIE_OPTIONS, expires: add(new Date(), { - minutes: TOKEN_CONFIG.ACCESS_TOKEN_COOKIE_EXPIRY, + hours: TOKEN_CONFIG.ACCESS_TOKEN_COOKIE_EXPIRY, }), req, res, @@ -214,7 +214,7 @@ export const swapAuth = async ({ await setCookie(TOKEN_CONFIG.REFRESH_TOKEN_COOKIE_NAME, refreshToken, { ...TOKEN_CONFIG.COOKIE_OPTIONS, expires: add(new Date(), { - minutes: TOKEN_CONFIG.REFRESH_TOKEN_COOKIE_EXPIRY, + days: TOKEN_CONFIG.REFRESH_TOKEN_COOKIE_EXPIRY, }), req, res,