Thursday, 11 May 2017

I am try to replace Bearer from header to verify the Token

  `bearer = bearerHeader.replace("Bearer","");
                    jwt.verify(bearer, 'super_secret', function (err, decoded) {
                            console.log(err);
                            console.log(decoded);`

here 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



via Nainesh Raval

No comments:

Post a Comment