passport.authenticate似乎始终允许访问,即使JWT令牌已过期。这是代码段
var cookieExtractor = function(req) {
var token = null;
if (req && req.cookies) {
token = req.cookies['access_token']
if (token)
token = token.replace("Bearer ","")
}
console.log('token=')
console.log(token)
return token;
};
const options = {
jwtFromRequest: cookieExtractor,
secretOrKey: PUB_KEY,
ignoreExpiration: false
}
module.exports = (db) => {
passport.use(new JwtStrategy(options, (jwtPayload, done) => {