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-3.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d36cce750280ad4ada19cb6082acb76033ccf2812b24925596324421a8f7ed26 |
|
MD5 | 40374d62d148ac372ca880bea649a15e |
|
BLAKE2b-256 | d103f96e6fbd1c673b6cd0bb4d803f1331a7422382445541ec98469d99718922 |
Hashes for django_microsoft_sso-3.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3b481694fe2ffb33e9995941091b8ebd665f8c0477edc3716f97eaf3b86158b |
|
MD5 | 335f334961406301c39641c702036f26 |
|
BLAKE2b-256 | 11fc0e534ba97ac5f827353ac21a0056873d779ce7a660ba14f67aa38e83b488 |