I developing an Express app for an organization, I'm using library activedirectory2 npm for get data from active directory.
I'm using two functions:
- Getting the details about the user by username - this function is working fine without problems.
- For getting the access groups for a user, I am using function
getGroupMembershipForUserand for a specific users I get this error:
"errno": "ECONNREFUSED",
"code": "ECONNREFUSED",
"syscall": "connect",
"address":"****","port":"
This happened for specific users, but not for everybody.
This is the function calling into AD:
const getGroupsByUsername = async (req, res) => {
try {
ad.getGroupMembershipForUser(req.ntlm.UserName, function (err, groups) {
if (err) {
console.log('ERROR: ' + JSON.stringify(err));
console.log("ERROR IN GET GROUPS BY USERNAME");
return;
}
if (!groups) {
console.log('User: ' + req.ntlm.UserName + ' not found.');
} else { res.json(groups) };
});
} catch (err) {
console.error(err.message);
res.status(500).send("Server Error");
}
};
Thanks