I have issue on connecting to LDAP server using ldapjs lib. For some reason I cannot bind to ldap server using my credentials:
var ldap = require('ldapjs');
function authDN(dn, password, cb) {
var client = ldap.createClient({url: 'ldaps://myserver:1234'});
client.bind(dn, password, function (err) {
client.unbind();
cb(err === null, err);
});
}
function output(res, err) {
if (res) {
console.log('success');
} else {
console.log('failure' + err.message);
}
}
// should print "success"
authDN('CN=J33nn,OU=Members,DC=domains', 'password', output);
// should print "failure"
authDN('cn=user', 'badpasswd', output);
To be perfectly sure I've checked my dn in LDAP and tested binding to LDAP using python script and it worked.
Any ideas what's wrong?