However, the boss came with an idea that I should use LDAP login since we have it and it provides a single sign-on solution, which is better.
So, I googled around and found python-ldap.
You can easily install it by running:
pip install python-ldapand it's ready to use.
The question is, how can I use it?
Check out the code I use below for references. The steps should be the same. However, you need to adjust some values accordingly to the LDAP settings in the server.
It's as easy as that and you can perform login and get the user credentials. In my app, I use Flask's session to put the user credentials so I can fetch it whenever I need to.
Feel free to use my code.