title: Can I pass my own data (object) back from passport.use('local') to passport.authenticate?
body: <p>I want to pass my own data from passport.use to passport.authenticate.</p>
  
  <p>I thought that the info parameter in 
  <code>passport.authenticate('local', function(err, user, info)</code>
  could be used for that.</p>
  
  <p>So is there a way to doing this ? </p>
  
  <p>My auth route</p>
  
  <pre><code>    passport.authenticate('local-register', (err, user, info) =&gt; {
        if (err) {
          return next(err); // 500 status
        }
        console.log(info);
        if (info) {
          console.log('rendering info ' + info);
          return res.render('auth/register', { info });
        } else {
          if (!user) {
            return res.status(409).render('auth/register');
          }
          req.login(user, err =&gt; {
            if (err) {
              console.log(err);
              return next(err);
            }
            return res.redirect('auth/profile');
          });
        }
      })(req, res, next);
    });
  </code></pre>
  
  <p>My config file</p>
  
  <pre><code>module.exports = passport =&gt; {
    passport.use(
      'local-register',
      new LocalStrategy(
        {
          ...
        },
        (req, email, password, done) =&gt; {
          // Check if form is filled out correctly
          let errors = [];
  
          //check for same email
          SCUser.findOne({ 'local.email': req.body.email }, (err, local) =&gt; {
            if (local) errors.push({ text: 'Email already in use.' });
  
            //check for same passwords
            ...
  
            //check for password length
            ...
  
            //abort if errors are found
            if (errors.length &gt; 0) {
              const info = {
                errors: errors,
                ...,
              };
              console.log(`returning info ${info}`);
              return done(null, info);
            }
  
            //form is filled in correctly create a user
            else {
            ...
            }
         ...
  </code></pre>
  
  <p>Random things I've tried so far: </p>
  
  <p>Adding <code>, form_validate</code> behind <code>info</code> &amp; changing the required variables to <code>form_validate</code> doesn't pass it through to the auth file.</p>
  
  <p>There are probably better ways to handle form validation, haven't looked that up yet, if you have any suggestions please tell me, but I still kind of want to know if it would be possible to pass custom objects through passports methods.</p>