-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing request parameter in JwtStrategy verify function documentation #35
Comments
You need to |
True. This can be closed. |
this is the code i am using and when i do console.log(jwt_payload.sub), it always says "undefined" and fetches the first record from DB. Can somebody please help? // Setup work and export for the JWT passport strategy opts.passReqToCallback = true; |
The passport.use() will automatically run when you call the passport.authenticate('jwt', cb). You should pass the authorization in header with valid JWT signed( |
Fixed it. |
show us d code at shahihedy |
Is there any way by which I could also get the server response in the JWTStrategy? |
When first implementing the sample code I was getting an error that 'jwt_payload.sub' was undefined. Looking a little closer I discovered that the verify function takes 3 args - the request, the payload, and callback. So:
passport.use(new JwtStrategy(opts, function(jwt_payload, done) {
Should be
passport.use(new JwtStrategy(opts, function(req, jwt_payload, done) {
The text was updated successfully, but these errors were encountered: