title: How to Pass Credentials to passport.authenticate?
body: <p>I'm trying to secure an API endpoint on a node.js express app that uses passport. </p>
  
  <p>This is my route:</p>
  
  <pre><code>router.post('/api/devices', authController.isAuthorized, catchErrors(deviceController.getDevicesAPI));
  </code></pre>
  
  <p>This is my authorization method:</p>
  
  <pre><code>exports.isAuthorized = (req, res, next) =&gt; {
    passport.authenticate('local', {session: false}, (err, user, info) =&gt; {
      if (err || !user) {
        return res.json({ message: 'Something is not right ', err, info });
      }
      req.login(user, {session: false}, (err) =&gt; {
        if (err) {
            res.send(err);
        }
        next();
      });
    })(req, res);
  };
  </code></pre>
  
  <p>From Postman or a separate local server, I get the response:</p>
  
  <pre><code>{
      "message": "Something is not right ",
      "err": null,
      "info": {
          "message": "Missing credentials"
      }
  }
  </code></pre>
  
  <p>This is the Postman configuration:
  <a href="https://i.stack.imgur.com/MxUzw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MxUzw.jpg" alt="Postman config"></a></p>
  
  <p>What am I missing?</p>