passport-local icon indicating copy to clipboard operation
passport-local copied to clipboard

Allow extra parameters to local verify call

Open MubashirSakhi opened this issue 9 years ago • 1 comments

i have a model with properties email, password, contact and name. What should i do? do i just use email and password to authenticate/ if yes then what about other paramters?

MubashirSakhi avatar Feb 10 '16 07:02 MubashirSakhi

http://stackoverflow.com/a/11784742/1431224

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.

abou7mied avatar Aug 01 '16 21:08 abou7mied