I am following this Tutorial.
But when i do sails lift
to run my application, i am getting below error.
throw new TypeError('JwtStrategy requires a function to retrieve jwt from requests (see option jwtFromRequest)');
^TypeError: JwtStrategy requires a function to retrieve jwt from requests (see option jwtFromRequest)
Please help me how to solve this error.
The problem is in the configuration of the options for the JwtStrategy, according to the github page, it's missing one option, jwtFromRequest, you need to use an extractor provided with the passport-jwt.
These are my modifications:
var ExtractJwt = require('passport-jwt').ExtractJwt;
var JWT_STRATEGY_CONFIG = {
jwtFromRequest: ExtractJwt.fromAuthHeader(),
secretOrKey: SECRET,
issuer : ISSUER,
audience: AUDIENCE,
passReqToCallback: false
};
I hope it help you