passport.authenticate() followed by(req, res, next) #931
Unanswered
jeremyshen1987
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey there,
I'm wondering what is the purpose of (req, res, next) at the end of passport.authenticate() ? If I remove those arguments, postman will froze and never get a response back.
app.post("/login", (req, res, next) => {
passport.authenticate("local", (err, user, info) => {
if (err) throw err;
if (info) res.json({errorMsg: info.message});
else {
res.json({userObj: user})
}
})(req, res, next); <== ====THIS LINE
});
Thanks,
Jeremy
Beta Was this translation helpful? Give feedback.
All reactions