title: what does req.login do in passport
body: <p>I am using multiple passport stratergy across my app.</p>
  
  <p>Now, since I am using multiple passport strategy to connect (and not to just sign-in), I decided to Google things on how to do it. </p>
  
  <p>This is where I stumbled upon this code </p>
  
  <pre><code> passport.authenticate('meetup', (err, user, info) =&gt; {
          if (err) { return next(err); }
          if (!user) { return res.redirect(process.env.CLIENT_ADDRESS); }
          req.logIn(user, function(err) {
              if (err) { return next(err); }
              return res.redirect(process.env.CLIENT_ADDRESS);
            });
  </code></pre>
  
  <p>Here I am unable to comprehend what is happening, like for first question, what is  <code>if (!user)</code>, Does it mean <code>req.user</code></p>
  
  <p>Second, there is  <code>req.logIn()</code></p>
  
  <p>According to <a href="http://www.passportjs.org/docs/login/" rel="noreferrer">passport docs</a>, </p>
  
  <blockquote>
    <p>Passport exposes a login() function on req (also aliased as logIn())
    that can be used to establish a login session.</p>
  </blockquote>
  
  <p>and </p>
  
  <blockquote>
    <p>When the login operation completes, user will be assigned to req.user.</p>
  </blockquote>
  
  <p>Then what is the difference between using <strong>serializer/deserializer</strong> when compared with <strong>req.login?</strong></p>
  
  <p>Also in the callback, we can always do this </p>
  
  <pre><code>  passReqToCallback: true
    }, (req, accessToken, refreshToken, params, profile, cb) =&gt; { 
  </code></pre>
  
  <p>to get <strong><code>req</code></strong></p>
  
  <p>To summarize can someone please help me comprehend the above code snippet?</p>