title: Passport-ldapauth : Missing Credentials
body: <p>I'm trying to create LDAP authentication with <a href="https://github.com/vesse/passport-ldapauth" rel="nofollow noreferrer">Passport's Ldap library</a> and I'm getting the following error: </p>
  
  <blockquote>
    <p>{
        "message": "Missing credentials" }</p>
  </blockquote>
  
  <p>Here is the code:</p>
  
  <pre><code>const passport = require("passport");
  const LdapStrategy = require("passport-ldapauth");
  
  let OPTS = {
    server: {
      url: "ldap://&lt;xxxx&gt;:389",
      bindDN: "dc=xxx-it,dc=com",
      searchBase: "ou=people",
      searchFilter: "(uid={{username}})"
    },
    usernameField: "username"
  };
  
  passport.use(
    new LdapStrategy(OPTS, (user, done) =&gt; {
      return done(null, user);
    })
  );
  </code></pre>
  
  <hr>
  
  <pre><code>  app.post("/api/test", (req, res, next) =&gt; {
      passport.authenticate("ldapauth", { session: false }, (err, user, info) =&gt; {
        var error = err || info;
        if (error) return res.status(401).json(error);
        if (!user)
          return res.json(404, {
            message: "Something went wrong, please try again."
          });
        var token = auth.signToken(user._id, user.role);
        res.json({ token: token });
      })(req, res, next);
    });
  </code></pre>
  
  <p>How should I send the username? Should I specify the bindCredentials field?</p>
  
  <p>Thanks</p>