Handling parameterised routes in express-jwt using unless -


given following route:

router.get('/api/members/confirm/:id, function (req, res, next) 

how specify route excluded? have tried:

app.use('/api', expressjwt({ secret: config.secret}).unless({path: ['/api/members/confirm']})); 

and

app.use('/api', expressjwt({ secret: config.secret}).unless({path: ['/api/members/confirm/:id']})); 

but neither path in unless array seem work?

the express-jwt module using express-unless give unless method, doesn't accept express' :param path arguments syntax.

but accept regex, this:

app.use('/api', expressjwt({ secret: config.secret}).unless({path: [/^\/api\/members\/confirm\/.*/]})); 

if don't that, can give unless function:

var myfilter = function(req) {return true;} app.use('/api', expressjwt({ secret: config.secret}).unless(myfilter)); 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -