LDAPjs is a pure JavaScript implementation of the LDAP protocol for Node.js, providing both client and server APIs. The current stable version is 3.0.7, released with bug fixes and security improvements. Version 3.0.0 introduced a major overhaul, splitting core LDAP operations into separate packages like @ldapjs/messages and @ldapjs/controls, and dropping support for older Node.js versions (<14). It is actively maintained, with regular releases and a focus on standards compliance and extensibility. Compared to alternatives like ldap-client or passport-ldapauth, ldapjs offers a lower-level, more flexible API suitable for building custom LDAP servers and clients.
npm install ldapNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a simple LDAP server that responds to searches, and a client that binds and unbinds.
Upgrade Node.js to v14 or later.
Install @ldapjs/messages and @ldapjs/controls as dependencies and import from those packages.
Set ldap.Attribute.settings.guid_format = ldap.GUID_FORMAT_D before accessing objectGUID.
Update to v3.x: npm install ldapjs@latest
Use event listeners: client.search() returns a Search object with 'searchEntry' and 'end' events.
Run 'npm install ldapjs' in your project directory.
Upgrade to a newer version: 'npm install ldapjs@latest'
Check your server setup: ldap.createServer() returns a server object with .search(), .bind(), etc.
Use a valid DN string; escape special characters if needed.