Automatic Login in a Django Application Using External Authentication

ybri profile image Yann Briançon ・1 min read

Django is one of the most famous Python frameworks. In this tutorial, I explain how to automatically log in users in its built-in admin interface using an LDAP.

Django provides a very useful admin interface that permits to manage users, display and modify model data. But have you ever tried to integrate a Django application in a big company?

I have and, most of the time, they already have an authentication system to authenticate their users. For example, 95% of future 1000 companies use Active Directory from Microsoft to manage their users.

Therefore, the users are authenticated all over the network and there is no point adding the Django Admin login page with custom credentials. Not to mention the company security department that would probably not accept a different credential database.

Let’s see how we can automatically log in users with a concrete example👇


Editor guide