title: passport authentication: user undefined after login
body: <p>I am trying to authenticate user ,when i try to login user after successful verification using <code>req.logIn</code> but it doesn't worked</p>
  
  <pre><code>router.post('/login', function(req, res, next) {
      passport.authenticate('login',function (cb,data) {
         //user verfication success
         if(data){
            req.logIn({user:"shamon"},function(err,result){
                console.log("result",result,err)
                res.send('login success');
            });
         }
      })(req,res,next);
  });
  </code></pre>
  
  <p>this <code>console.log("result",result,err)</code>  gives me <code>undefined,undefined</code> </p>
  
  <p>when i log <code>req.user</code> after logged i got undefined error</p>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>var LocalStrategy    = require('passport-local').Strategy
  
  module.exports = function(passport){
  
      passport.use('local',new LocalStrategy({
          usernameField: 'email',
          passwordField: 'password'
      },function (username,password,done) {
           console.log('inside passport');
           return done(null,true);
      }));
  
  
  
      passport.serializeUser(function(user, done) {
          done(null, user);
      });
  
      passport.deserializeUser(function(user, done) {
          done(null,user);
      });
  
  }
  </code></pre>