How to use LDAP authentication in Angular 8

4,412 views
Skip to first unread message

Lucky

unread,
Mar 24, 2020, 9:40:58 AM3/24/20
to Angular and AngularJS discussion
Hi,

I want to use LDAP authentication in angular 8.
There is existing LDAP server and want to authenticate the user by querying that LDAP server using some client API.

I have found client APIs @ https://ldap.com/client-apis/
I have tried using "ldapjs" module since its javascript module assuming angular 8 supports it as Angular 8 is in typescript which in turn complied into javascript.

I have found few articles about how to use external javascript libraries in Angular 8 , but none of them worked.

Steps done:
1. Installed ldapjs using npm install
2. Added that in "scripts" part in my angular.json
3. Trying to use ldapjs code in my angular app from below, but always ended up getting "createClient()" is not a function error.

I have tried to restart the front end server as suggested in other forums, but not worked.

Need help very badly, struggling to make this work from few days.

Thanks in advance.

Sander Elias

unread,
Apr 1, 2020, 12:57:18 AM4/1/20
to Angular and AngularJS discussion
Hi Luckey,

The LDAP client you listed is not suited for use in a browser. It is a nodeJS only library. As far as I know, the LDAP protocol is not accessible from web-browsers. On the protocol level, so there is no way to access it directly from the web.

Regards
Sander

Lucky

unread,
Apr 1, 2020, 2:34:48 AM4/1/20
to Angular and AngularJS discussion
Hi Sander,

Thank you for your response.
I have created node js back end server as its a nodeJS libray using "express".
I am sending the credentials from front end to back end server using HTTP post.
Sending back the reponse to the front end.
Am able to get the user details in front end using ldapjs, but facing issue in doing the "bind" ( authenticating).
Always getting "invalid credentials" error even though they are correct.
Looks like issue in forming the "bindDN", trying to check on this.

It would be helpful if you can provide any details about bindDn.

Thank you.
Reply all
Reply to author
Forward
0 new messages