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?
Maybe the username format is wrong or your DN is not correct, instead of
CN=J33nn,OU=Members,DC=domains
Try using:
[email protected]
Or you should use a LDAP exlorer tool to check your real/correct DN name by bind to your LDAP server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With