Using PassportJS, how does one pass additional form fields to the local authentication strategy?
There's a passReqToCallback
option that you can enable, like so:
passport.use(new LocalStrategy(
{usernameField: 'email', passReqToCallback: true},
function(req, email, password, done) {
// now you can check req.body.foo
}
));
When, set req
becomes the first argument to the verify callback, and you can inspect it as you wish.