Browse project docs

Getting Started

Install ldapjs-community as an ldapjs v2 replacement, create a client, bind, and verify a directory connection.

On this page

ldapjs-community is a community-maintained, independent fork of ldapjs v2. It is not affiliated with or endorsed by the original ldapjs maintainers.

Link to Check compatibility firstCheck compatibility first

Use this path only when the application depends on the ldapjs v2 API. The upstream README explicitly says ldapjs v3 users should not switch yet.

The published package declares a Node.js engine of >=10.13.0. Its 2.4.0 release notes separately record a CI matrix of Node.js 18, 20, 22, and 24. The engine declaration and tested matrix describe different things; neither is a guarantee for an untested deployment.

Link to Install the replacementInstall the replacement

Install the fork under the original dependency name so existing imports remain unchanged:

bash
npm install ldapjs@npm:ldapjs-community@^2.4.0

Verify the resolved package:

bash
npm ls ldapjs

The dependency tree should resolve ldapjs to ldapjs-community 2.4.0 or another version allowed by the declared range.

Link to Create and bind a clientCreate and bind a client

Set LDAP_URL, LDAP_BIND_DN, and LDAP_PASSWORD, then run:

javascript
const ldap = require('ldapjs')

const client = ldap.createClient({
  url: process.env.LDAP_URL
})

client.on('error', (err) => {
  console.error('LDAP connection error:', err)
})

client.bind(process.env.LDAP_BIND_DN, process.env.LDAP_PASSWORD, (err) => {
  if (err) {
    client.destroy()
    throw err
  }

  console.log('LDAP bind succeeded')
  client.unbind()
})

Link to ContinueContinue

For bind semantics, read LDAP bind explained.

Link to SourcesSources