V
V
vetsmen2017-10-20 18:11:30
JavaScript
vetsmen, 2017-10-20 18:11:30

Header in passport-jwt?

Good day. There is a very good library for working with the jwt token.
I generated it on the server, ok. When I try to write in the title, he does not see it, apparently I am not composing the title in the right way.
Current example:

var opts = {
  jwtFromRequest: ExtractJwt.fromHeader('Authfield'),
  secretOrKey: config.secret_jwt
}

passport.use(new JwtStrategy(opts, function(jwt_payload, done) {
    console.log(jwt_payload);
    next(null, false);
}));

The headers were of various kinds, and Authfield: , and Authfield: JWT , and Authorization: JWT , everything is wrong. How to compose them correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alvvi, 2017-10-20
@vetsmen

https://jwt.io/introduction/
Authorization: Bearer <token>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question