Easily add Microsoft Authentication to your Django Projects
Project description
Easily integrate Microsoft Authentication into your Django projects
Welcome to Django Microsoft SSO
This library aims to simplify the process of authenticating users with Microsoft in Django Admin pages, inspired by libraries like django_microsoft_auth and django-admin-sso
Documentation
Install
$ pip install django-microsoft-sso
Configure
- Add the following to your
settings.py
INSTALLED_APPS
:
# settings.py
INSTALLED_APPS = [
# other django apps
"django.contrib.messages", # Need for Auth messages
"django_microsoft_sso", # Add django_microsoft_sso
]
- In Microsoft Entra Administration Center at Application Register, retrieve your
Application ID. Navigate to Certificate & secrets link, and get the Client Secret Value. Add both in your
settings.py
:
# settings.py
MICROSOFT_SSO_APPLICATION_ID = "your Application ID here"
MICROSOFT_SSO_CLIENT_SECRET = "your Client Secret Value here"
-
Add the callback uri
http://localhost:8000/microsoft_sso/callback/
in your Microsoft Console, on the "Authorized Redirect URL". -
Let Django Microsoft SSO auto create users for allowable domains:
# settings.py
MICROSOFT_SSO_ALLOWABLE_DOMAINS = ["contoso.com"]
- In
urls.py
please add the Django-Microsoft-SSO views:
# urls.py
from django.urls import include, path
urlpatterns = [
# other urlpatterns...
path(
"microsoft_sso/", include("django_microsoft_sso.urls", namespace="django_microsoft_sso")
),
]
- And run migrations:
$ python manage.py migrate
That's it. Start django on port 8000 and open your browser in http://localhost:8000/admin/login
and you should see the
Microsoft SSO button.
License
This project is licensed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_microsoft_sso-2.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a229ecacbeac474c45effb2e686e3b15e942ef7a7e15ba09f5594ed9c23738e |
|
MD5 | 23c480ea3ca7b9da42780537e85e24fc |
|
BLAKE2b-256 | 768be0b56b761089b28624f76443d529c967241fe51e357707e88840e4e842ee |
Hashes for django_microsoft_sso-2.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73a0c6045c446b915732b13a5089806ebcc90059aaf9ec3fd77a0fc5489ee90a |
|
MD5 | 1d0dce101549a53e6202935695d1ddff |
|
BLAKE2b-256 | dad28f442c0cdf92bf5ded61dd214501f118d91ee0267e4d16aa03398d456a23 |