amrav / restify-jwt Goto Github PK
View Code? Open in Web Editor NEWThis project forked from auth0/express-jwt
restify middleware that validates a JsonWebToken (JWT) and sets the req.user with the attributes
License: Other
This project forked from auth0/express-jwt
restify middleware that validates a JsonWebToken (JWT) and sets the req.user with the attributes
License: Other
What is the Shared Secret that is mentioned in the usage examples?
I don't understand how the shared secret is specified or used.
Any insight is appreciated.
Can this module be used to sign (generate) jwt, or it is used for verification only (and we must install some other module like jsonwebtoken
to generate jwts)?
Hello,
In the doc of your plugin, it's written that we can add our custom logic to manage unauthorized access.
With this code:
app.use(function (err, req, res, next) {
if (err.name === 'UnauthorizedError') {
res.send(401, 'invalid token...');
}
});
But, if we read the doc of restify, the callback will receive only 3 parameters : req, res and next.
(source: http://restify.com/#common-handlers-serveruse)
I have tested with 4 parameters but the function only receive 3 parameters...
In my application, I am using your module only for route that need to be protected, like this:
app.get('/example/:id', jwt({ secret: mySecret }) , (req, res) => { /* the code of the route */ });
Did I miss something?
First of all, thank you @amrav for making express-jwt to work with restify.
It seems that express-jwt was updated around a month ago and I think that would be beneficial to keep restify-jwt up to date with that code.
Would it be possible for you to publish a new version that works with the latest version of Restify or at least publish the latest master as a next
tag in NPM so git doesn't have to be used?
Hi,
The restify-jwt code base does not support the latest version of restify (i.e. errors being moved out to separate library: https://github.com/restify/errors)
Is there a new version of restify-jwt that supports this or could a contributor update the code base to support the latest version of restify?
Thanks
node_modules/restify-jwt/lib/index.js:71
return next(restify.InvalidCredentialsError('No authorization token was found'));
^
TypeError: restify.InvalidCredentialsError is not a function
at middleware (/home/jonatas.freitas/Projects/rta_api/node_modules/restify-jwt/lib/index.js:71:29)
at call (/home/jonatas.freitas/Projects/rta_api/node_modules/restify/lib/chain.js:164:9)
at next (/home/jonatas.freitas/Projects/rta_api/node_modules/restify/lib/chain.js:120:9)
at Chain.run (/home/jonatas.freitas/Projects/rta_api/node_modules/restify/lib/chain.js:123:5)
at Server._runUse (/home/jonatas.freitas/Projects/rta_api/node_modules/restify/lib/server.js:976:19)
at Server._runRoute (/home/jonatas.freitas/Projects/rta_api/node_modules/restify/lib/server.js:918:10)
at Server._afterPre (/home/jonatas.freitas/Projects/rta_api/node_modules/restify/lib/server.js:888:10)
at Immediate.preChainDone [as _onImmediate] (/home/jonatas.freitas/Projects/rta_api/node_modules/restify/lib/server.js:856:14)
at runCallback (timers.js:791:20)
at tryOnImmediate (timers.js:747:5)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.