add logs to debug JWT authentication process
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user