Closed ghost closed 5 years ago
I guess if you change
opts.jwtFromRequest = ExtractJwt.fromAuthHeaderWithScheme('jwt')
to
opts.jwtFromRequest = ExtractJwt.fromAuthHeaderWithScheme('JWT')
things cook well as you wish.
Closing since header string comparison has been case insensitive since version 3.0.0
Hello,
I'm having a strange issue with passport-jwt.
Everything is well configured as below :
server.js
passport.js
and the routes.js
The login controller works great, it give me : "JWT " + token
When i try to access at my protected route, in my terminal i have this log :
{ sub: 2, iat: 1510066964872, type_of_user: 'admins', exp: 1510066974952 } Executing (default): SELECT id, username, firstname, lastname, email, password, currentSignin, lastSignin, currentIp, createdAt, updatedAt FROM Admins AS Admin WHERE Admin.id = 2;
GET /admins/profile 401 5.257 ms - -
Unauthorized ...
I really dont know what is wrong ...
My passport-jwt version is : ^3.0.1
Thanks,
Antoine