Skip to content Skip to sidebar Skip to footer

I'm Getting An Error Authenticating With Password-jwt

I'm getting this weird error authenticating with Password-Jwt, i'm kinda new to this so any help would be much appreciated. passport.js file : const jwtStrategy = require

Solution 1:

So you have to use new JwtStrategy(opts, callbackFunction)

Have a look at the sample usage from the documentation.

passport.use(new JwtStrategy(opts, function(jwt_payload, done) {
    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);
            // or you could create a new account
        }
    });
}));

Post a Comment for "I'm Getting An Error Authenticating With Password-jwt"