@konplit-services/common 1.0.399 → 1.0.400
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -24,6 +24,18 @@ const currentUser = (req, res, next) => __awaiter(void 0, void 0, void 0, functi
|
|
|
24
24
|
if (req.headers["authorization"]) {
|
|
25
25
|
const token = req.headers["authorization"].split(" ")[1];
|
|
26
26
|
const payload = yield Jwt_1.JWT.verifyToken(token);
|
|
27
|
+
// Add this debug logic:
|
|
28
|
+
const now = Math.floor(Date.now() / 1000); // Current time in seconds
|
|
29
|
+
const timeElapsed = (now - payload.iat);
|
|
30
|
+
const timeRemaining = payload.exp - now;
|
|
31
|
+
const tokenLifetime = payload.exp - payload.iat;
|
|
32
|
+
console.log({
|
|
33
|
+
issuedAt: new Date(payload.iat * 1000).toISOString(),
|
|
34
|
+
expiresAt: new Date(payload.exp * 1000).toISOString(),
|
|
35
|
+
timeElapsed,
|
|
36
|
+
timeRemaining,
|
|
37
|
+
tokenLifetime,
|
|
38
|
+
});
|
|
27
39
|
if (payload.type !== Jwt_1.JWTType.ACCESS) {
|
|
28
40
|
throw new notAuthorized_1.NotAuthorizedError(language_1.lang.not_authorized, error_codes_1.error_codes.INVALID_AUTHORIZATION);
|
|
29
41
|
}
|
package/build/services/Jwt.d.ts
CHANGED