node-ldapjs: Error: urlStr + ' is an invalid LDAP url (scope)'
Hi, I am using this very simple code to connect to LDAP but no matter what i keep on getting the following error:
var ldap = require('ldapjs');
var client = ldap.createClient({url:'ldap://openam.sandbox.local:10389'});
client.bind('cn=DM', 'test', function(err) {
if (err){
console.log("not able to connect")
} else {
console.log("connected successfully")
}
});
I am using mac.
/Users/ashishjindal/Projects/sw-app-api/api-testing/node_modules/ldapjs/lib/url.js:15
throw new TypeError(urlStr + ' is an invalid LDAP url (scope)')
^
TypeError: ldap://openam.sandbox.local:10389 is an invalid LDAP url (scope)
at Object.parse (/Users/ashishjindal/Projects/sw-app-api/api-testing/node_modules/ldapjs/lib/url.js:15:13)
at new Client (/Users/ashishjindal/Projects/sw-app-api/api-testing/node_modules/ldapjs/lib/client/client.js:114:33)
at Object.createClient (/Users/ashishjindal/Projects/sw-app-api/api-testing/node_modules/ldapjs/lib/client/index.js:17:12)
at Object.<anonymous> (/Users/ashishjindal/Projects/sw-app-api/api-testing/tests/builders/ldap.js:3:19)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
[Done] exited with code=1 in 0.148 seconds
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (7 by maintainers)
i got it working my changing url.URL to url.Parse parsedURL = new url.parse(urlStr) //parsedURL = new url.URL(urlStr) } catch (error) {