Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix(backend): use duration instead of timestamp for auth cookie maxAge (#5821)

No jae gun2dc3463b698f
diff --git a/packages/hoppscotch-backend/src/auth/helper.ts b/packages/hoppscotch-backend/src/auth/helper.ts
index c417fb267..0f58b8be6 100644
--- a/packages/hoppscotch-backend/src/auth/helper.ts
+++ b/packages/hoppscotch-backend/src/auth/helper.ts
@@ -58,13 +58,13 @@ export const authCookieHandler = (
httpOnly: true,
secure: configService.get('INFRA.ALLOW_SECURE_COOKIES') === 'true',
sameSite: 'lax',
- maxAge: Date.now() + accessTokenValidityInMs,
+ maxAge: accessTokenValidityInMs,
});
res.cookie(AuthTokenType.REFRESH_TOKEN, authTokens.refresh_token, {
httpOnly: true,
secure: configService.get('INFRA.ALLOW_SECURE_COOKIES') === 'true',
sameSite: 'lax',
- maxAge: Date.now() + refreshTokenValidityInMs,
+ maxAge: refreshTokenValidityInMs,
});
if (!redirect) {