Д
ExtractJwt.fromAuthHeaderWithScheme('JWT')
попробуй заменить на ExtractJwt.fromAuthHeaderWithScheme('jwt')Size: a a a
Д
ExtractJwt.fromAuthHeaderWithScheme('JWT')
попробуй заменить на ExtractJwt.fromAuthHeaderWithScheme('jwt')Д
ExtractJwt.fromHeader('Authorization');Д
ДФ
res.cookie("session", "123");Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 20
Date: Mon, 07 Sep 2020 08:40:17 GMT
Set-Cookie: session=123; Path=/
X-Powered-By: Express
A
ДФ
res.cookie("session", "123");Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 20
Date: Mon, 07 Sep 2020 08:40:17 GMT
Set-Cookie: session=123; Path=/
X-Powered-By: Express
С
GS
A
const options = {
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
secretOrKey: 'www',
algorithms: ['RS256']
};
module.exports = (passport) => {
passport.use(new JwtStrategy(options, function(jwt_payload, done) {
console.log(jwt_payload);
User.findOne({_id: jwt_payload.sub}, function(err, user) {
if (err) {
return done(err, false);
}
if (user) {
return done(null, user);
} else {
return done(null, false);
}
});
}));
}Д
const options = {
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
secretOrKey: 'www',
algorithms: ['RS256']
};
module.exports = (passport) => {
passport.use(new JwtStrategy(options, function(jwt_payload, done) {
console.log(jwt_payload);
User.findOne({_id: jwt_payload.sub}, function(err, user) {
if (err) {
return done(err, false);
}
if (user) {
return done(null, user);
} else {
return done(null, false);
}
});
}));
}A
Д
A
Д
Д
The strategy will first check the request for the standard Authorization header. If this header is present and the scheme matches options.authScheme or 'JWT' if no auth scheme was specified then the token will be retrieved from it. e.g.
Authorization: JWT JSON_WEB_TOKEN_STRING.....
If the authorization header with the expected scheme is not found, the request body will be checked for a field matching either options.tokenBodyField or auth_token if the option was not specified.
Finally, the URL query parameters will be checked for a field matching either options.tokenQueryParameterName or auth_token if the option was not specified.ZM
S
ZM
S