Compatibility with Sails
See original GitHub issueI love this repository and I’m trying to use it in a Sails project.
Express middleware in sails as known as policies and internally sails use express 3.x.
Simply you can define a policies and decide what route request pass for each policies (if is necessary).
The interface for create the policy is the same to create a middleware:
module.exports = function(req, res, next) {
// do something
};
I want to validate the header token with express-jwt
and later do a custom action in the policy (for example, search the user and expose in req.user
) I’m not sure how to concatenate the middlewares to get in the more external middleware the callback of the express-jwt
.
Just something like this:
var options = {secret: 'seeeecret!'};
var expressjwt = require('express-jwt')({options});
module.exports = function(req, res, next) {
expressjwt(req, res, function(token){
// Now I have the token
// do something
next();
});
};
Do you think that is possible?
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
FAQ | Sails.js
We regularly send security/compatibility reports about dependencies to the primary email address associated with your account. If you'd like additional ...
Read more >balderdashy/sails: Realtime MVC Framework for Node.js
Compatibility. Sails is built on Node.js, Express, and Socket.io. Sails actions are compatible with Connect middleware, so in most cases ...
Read more >sails - npm
API-driven framework for building realtime apps, using MVC conventions (based on Express and Socket.io). Latest version: 1.5.3, ...
Read more >sails | Yarn - Package Manager
Sails.js · Installation · Your First Sails Project · Compatibility · Tutorial Course · Books · Support · Issue Submission · Contribute.
Read more >Sails.js adapter compatibility issue in sails 1.0 - Stack Overflow
The adapter used by the sailsElastic datastore is not compatible with the current version of Sails/Waterline. The adapter should expose a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks!!! works perfect. Actually jsonwebtoken library validate the token, so
token
parameter isundefined
. This works fine:so, finally, what about add this in the documentation for future users? 😃
no, you can create JWTs where the payload is a JSON, like this:
in fact most of the time we use this instead of string.
I’ve fixed this on version
v1.3.1
.Please next time create another issue, this issue has been closed already.
Thanks for reporting it