We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instead of :
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 } }); }));
use this code:
passport.use(new JwtStrategy(opts, async function(jwt_payload, done) { try { const user = await User.findOne({ _id: jwt_payload.sub }); if (user) { return done(null, user); } else { return done(null, false); } } catch (err) { return done(err, false); } }));
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Instead of :
use this code:
The text was updated successfully, but these errors were encountered: