ldap Invalid Credentials While Authenticating User(NodeJs)

Viewed 316

There are two Active Directory (LDAP Servers). Following are the users which belongs to their servers respectively.

     Server         user                         password

1-   abc.pk           user_abc@abc.pk              ********

2-   xyz.com.pk       user_xyz@xyz.com.pk          ******** 

I am authenticating the user in NodeJS with library (ActiveDirectory). Below is my code where I am authenticating user_xyz@xyz.com.pk from its respective server.

       const ActiveDirectory = require('activedirectory');
       var ad = new ActiveDirectory({
           "url": "ldap://xyz.com.pk",
           "baseDN": "DC=xyz,DC=com,DC=pk"
});
                    ad.authenticate(username, password, function(err, auth) {
                        console.log('auth function called with username: '+username);
                        if (err) {
                            console.log('auth function called and with following err  '+JSON.stringify(err));
                            return;
                        }           
                        if (auth) {
                          console.log('Authenticated from Active directory!');
                      });

it works fine. Same works fine if I authenticate user_abc@abc.pk from server 1 by updating the url and baseDN.

       var ad = new ActiveDirectory({
           "url": "ldap://abc.pk",
           "baseDN": "DC=abc,DC=pk"
});       

Server abc.pk has Trust Relations with Server xyz.com.pk. Means I have to authenticate the user user_abc@abc.pk from the Server xyz.com.pk . using the following configurations.

      var ad = new ActiveDirectory({
               "url": "ldap://xyz.com.pk",
               "baseDN": "DC=xyz,DC=com,DC=pk"
    });

but now facing the error of invalid credentials. This is the exact error I am facing {"lde_message":"80090308: LdapErr: DSID-0C090453, comment: AcceptSecurityContext error, data 52e, v3839\u0000","lde_dn":null}

If I authenticate the user_abc@abc.pk from xyz.com.pk Server with Active Directory Explorer it works fine.

Active Directory Explorer image

It would be a great help if someone could give me a solution. Thanks

0 Answers
Related