I use npm install ldapjs
to use this library. And simple bind code:
var ldap = require('ldapjs');
var client = ldap.createClient({
url: 'ldap://192.168.1.90:389'
})
const baseDN = 'dc=mnw-inc,dc=com'
export function login(username, password) {
client.bind(rootDN, rootpasswd, function(err, res) {
// here handle response
})
}
This is a react app and I run the app. I got this error in consol
Uncaught TypeError: net.connect is not a function
at connectSocket (client.js:1039)
at Backoff.<anonymous> (client.js:1203)
at Backoff../node_modules/events/events.js.EventEmitter.emit (events.js:84)
at Backoff../node_modules/backoff/lib/backoff.js.Backoff.onBackoff_ (backoff.js:53)
When I call the login()
function nothing return at all.
What could I do?