Skip to content

Commit 0fd76f6

Browse files
committed
fix: convert token and session expiration times to milliseconds
1 parent 26f2f4a commit 0fd76f6

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

.env.development

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ SESSION_EXPIRES_IN=86400
1717
# AUTH
1818
PASSWORD_RESET_TOKEN_EXPIRES_IN=86400
1919
SET_PASSWORD_TOKEN_EXPIRES_IN=86400
20-
SET_SESSION=0
20+
SET_SESSION=1
2121

2222
# DATABSES
2323
REDIS_URL="redis://localhost:6380"

src/modules/auth/auth.constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export const COOKIE_CONFIG: CookieOptions = {
99
httpOnly: true,
1010
sameSite: "lax",
1111
secure: config.NODE_ENV === "production",
12-
maxAge: config.SESSION_EXPIRES_IN,
12+
maxAge: config.SESSION_EXPIRES_IN * 1000,
1313
domain: clientSideUrl.hostname,
1414
};

src/utils/auth.utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ export const compareHash = async (
4848
};
4949
export const signToken = async (payload: JwtPayload): Promise<string> => {
5050
return sign(payload, String(config.JWT_SECRET), {
51-
expiresIn: Number(config.JWT_EXPIRES_IN),
51+
expiresIn: Number(config.JWT_EXPIRES_IN) * 1000,
5252
});
5353
};
5454

5555
export const signPasswordResetToken = async (
5656
payload: PasswordResetTokenPayload,
5757
) => {
5858
return sign(payload, String(config.JWT_SECRET), {
59-
expiresIn: config.PASSWORD_RESET_TOKEN_EXPIRES_IN,
59+
expiresIn: config.PASSWORD_RESET_TOKEN_EXPIRES_IN * 1000,
6060
});
6161
};
6262

0 commit comments

Comments
 (0)