Horje

Node.js - Windows authentication under node.js
Start
  Using activedirectory

The example below is taken from the full docs, available here (GitHub) (opens new window) or here (NPM) (opens new window).

Installation

npm install --save activedirectory

Usage

// Initialize
var ActiveDirectory = require('activedirectory');
var config = {
    url: 'ldap://dc.domain.com',
    baseDN: 'dc=domain,dc=com'
};
var ad = new ActiveDirectory(config);
var username = '[email protected]';
var password = 'password';
// Authenticate
ad.authenticate(username, password, function(err, auth) {
    if (err) {
        console.log('ERROR: '+JSON.stringify(err));
        return;
    }
    if (auth) {
        console.log('Authenticated!');
    }
    else {
        console.log('Authentication failed!');
    }
});

Remarks

There are several other Active Directory APIS, such as activedirectory2 (opens new window) and adldap (opens new window).


Read Article
https://develop.horje.com/learn/1434/reference