add logs to debug JWT authentication process

This commit is contained in:
StarAppeal
2025-09-04 00:33:02 +02:00
parent eafa70fd29
commit 1e8e040c53
+5
View File
@@ -9,11 +9,16 @@ export function authenticateJwt(
//remove Bearer from the beginning of the token
const token = req.headers["authorization"]?.slice("Bearer ".length);
console.log(token);
const jwtAuthenticator = new JwtAuthenticator(
process.env.SECRET_KEY as string,
);
console.log(process.env.SECRET_KEY)
const decodedToken = jwtAuthenticator.verifyToken(token);
console.log(decodedToken)
if (!decodedToken) {
return res.status(401).send("Unauthorized");
}