Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding problem #24

Open
mkermani144 opened this issue Aug 28, 2016 · 1 comment
Open

Binding problem #24

mkermani144 opened this issue Aug 28, 2016 · 1 comment

Comments

@mkermani144
Copy link

When I try to use node-ldapauth, I get the following error:

Error: LDAP connection is not yet bound
...

My code seems like this:

var config = {
        ldap: {
            url: "ldap://1.2.3.4",
            adminDn: "cn=admin, dc=sub, dc=domain",
            adminPassword: "Secret",
            searchBase: "dc=sub, dc=domain",
            searchFilter: "(cn={{username}})" 
        }
    };
var auth = new ldap({
    url: config.ldap.url,
    adminDn: config.ldap.adminDn,
    adminPassword: config.ldap.adminPassword,
    searchBase: config.ldap.searchBase,
    searchFilter: config.ldap.searchFilter
});
auth.authenticate('cn=sample , ou=sub1, ou=sub2, dc=sub, dc=domain', 'samplesecret', function(err, user) {
        if (err) {
            console.log(err);
            res.writeHead('401');
            res.end()
        } else {
            res.writeHead('200');
            res.end();
        }
    });

I am sure that the credentials are valid.
I also tried cn=sample instead of cn={{username}} but the problem does not resolve.
Any idea?

@luiselizondo
Copy link

From the source code:

*
 *    // If you want to be lazier you can skip waiting for 'connect'. :)
 *    // It just means that a quick `.authenticate()` call will likely fail
 *    // while the LDAP connect and bind is still being done.
 *    auth.once('connect', function () {
 *        ...
 *        auth.authenticate(username, password, function (err, user) { ... });
 *        ...
 *        auth.close(function (err) { ... })
 *    });
 */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants