fake-api-jwt-json-server
fake-api-jwt-json-server copied to clipboard
function verifyToken return error not throw it
Hi!
When I try to get access to fake-api with this get request
GET http://localhost:3000/products Authorization: Bearer
I get all the data. But I think I shouldn't. I expecting to get an error "jwt must be provided".
I guess code should be corrected some how like this
let verifyTokenResult; try { verifyTokenResult = verifyToken(req.headers.authorization.split(' ')[1]); if (verifyTokenResult instanceof Error) { throw verifyTokenResult; } next()