Jwt How To Bypass Certain Api Routes And Http Methods
I can make get JSON-Web-Token to ignore paths using .unless like this. app.use(expressJWT({secret: config.JWTSECRET}).unless({path: ['/register', '/authentication', ]})); I have
Solution 1:
If I know right, the express-jwt module is using express-unless
to give you .unless
method. With that, you can use a custom function to filter the request.
var filter = function(req) {returntrue;}
app.use(expressJWT({ secret: config.JWTSECRET}).unless(filter));
In the filter
function, you can check the route (req.path
) and the request type (req.method
).
Post a Comment for "Jwt How To Bypass Certain Api Routes And Http Methods"