bearer = bearerHeader.replace("Bearer","");
jwt.verify(bearer, 'super_secret', function (err, decoded) {
console.log(err);
console.log(decoded);
});
Here is my code. Whenever I try to verify Token. I want to replace Bearer from header to verify only token. it will always goes to 'err' if a take Bearer. when i remove the Bearer from header i will work perfect. anyone please help me to solve this. Is there any way to solve this problem?
Output:
{
[JsonWebTokenError: invalid token] name: 'JsonWebTokenError',
message: 'invalid token'
}
undefined