3

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.