title: Bad Request error using passport-ldapauth
body: <ol>
  <li><p>I am trying to authenticate username and password using
  passport-ldapauth npm. while executing the below code I am always
  getting error as  Bad Request. Kindly help me what is wrong with my
  code.</p>
  
  <pre><code>var express      = require('express'),
      passport     = require('passport'),
      bodyParser   = require('body-parser'),
      LdapStrategy = require('passport-ldapauth');
  
  // Credentials from the free LDAP test server by LDAP Search
  
  var OPTS = {
    server: {
  
      url: 'ldap://54.227.207.201:389',
      bindDn: 'CN=simple One,CN=Users,DC=test,DC=local',
      bindCredentials: 'password',
      searchBase: 'ou=passport-ldapauth',
      searchFilter: '(uid={{username}})'
    },
    usernameField: "CN=simple One,CN=Users,DC=test,DC=local",
    passwordField: "password"
  };
  
  var app = express();
  
  passport.use(new LdapStrategy(OPTS));
  
  app.use(bodyParser.json());
  
  app.use(bodyParser.urlencoded({extended: false}));
  
  app.use(passport.initialize());
  
  
  app.use(passport.session());    
  
  app.post('/login', passport.authenticate('ldapauth', {session: false}), function(req, res)  {  
  
  // you can refer code from here:https://github.com/vesse/passport-ldapauth
  
    res.send({status: 'ok'});//will generate error 'Bad Request'
  
  });
     /*For more info:https://github.com/vesse/passport-ldapauth/issues/45*/
  </code></pre></li>
  </ol>