Been playing around with NodeJS in the past few days and run stuck with LDAP connection using ldapjs module. Background story, the Active-Directory server, that I am trying to connect to, supports LDAPv3.
Below is the code I used to connect to the LDAP server:
var ldapClient = ldap.createClient({url: 'ldap://ldap.myhost.com.au:389'}, function (err){
if (err) {
console.log('Failed');
process.exit(1);
}
else
console.log('Through');
});
In the given example, it doesn't include the last callback function, I tried it as the common pattern mentioned that most operations include callback so I thought I could have a bit of luck with it, I didn't.
I have also tried with and without the callback, still didn't work.
The ldapClient container will always return true even when I change the url into an invalid one.
Anyone could share how it's done?
Aucun commentaire:
Enregistrer un commentaire