I\'m New to node js. I\'m using passport jwt for authentication. When i tried to authenticate, its always showing \"unauthorized\".
my passport.js file
I found out the issue, In new passport-jwt updates, we have to use
opts.jwtFromRequest = ExtractJwt.fromAuthHeaderWithScheme('jwt');
if you are using opts.jwtFromRequest = ExtractJwt.fromAuthHeaderAsBearerToken();
as your jwtFromRequest
then your Authorization header is like
bearer xxxxx.yyyyy.zzzzz
you can check the BEARER_AUTH_SCHEME specified in the extract_jwt.js
located in the passport-jwt/lib
folder
if you are using opts.jwtFromRequest = ExtractJwt.fromAuthHeaderWithScheme('jwt')
as your jwtFromRequest
then your Authorization header is like
JWT xxxxx.yyyyy.zzzzz
you can check the LEGACY_AUTH_SCHEME specified in the extract_jwt.js
located in the passport-jwt/lib
folder