<p align="center">
<img src="docs/images/django-microsoft-sso.png" alt="Django Microsoft SSO"/>
</p>
<p align="center">
<em>Easily integrate Microsoft Authentication into your Django projects</em>
</p>
<p align="center">
<a href="https://pypi.org/project/django-microsoft-sso/" target="_blank">
<img alt="PyPI" src="https://img.shields.io/pypi/v/django-microsoft-sso"/></a>
<a href="https://github.com/megalus/django-microsoft-sso/actions" target="_blank">
<img alt="Build" src="https://github.com/megalus/django-microsoft-sso/workflows/tests/badge.svg"/>
</a>
<a href="https://www.python.org" target="_blank">
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/django-microsoft-sso"/>
</a>
<a href="https://www.djangoproject.com/" target="_blank">
<img alt="PyPI - Django Version" src="https://img.shields.io/pypi/djversions/django-microsoft-sso"/>
</a>
</p>
## Welcome to Django Microsoft SSO
This library aims to simplify the process of authenticating users with Microsoft 365 in Django Admin pages,
inspired by libraries like [django_microsoft_auth](https://github.com/AngellusMortis/django_microsoft_auth)
and [django-admin-sso](https://github.com/matthiask/django-admin-sso/)
---
### Documentation
* Docs: https://megalus.github.io/django-microsoft-sso/
---
### Install
```shell
$ pip install django-microsoft-sso
```
> **Compatibility**
> - Python 3.11, 3.12, 3.13
> - Django 4.2, 5.0, 5.1, 5.2
>
> Older python/django versions are not supported.
### Configure
1. Add the following to your `settings.py` `INSTALLED_APPS`:
```python
# settings.py
INSTALLED_APPS = [
# other django apps
"django.contrib.messages", # Need for Auth messages
"django_microsoft_sso", # Add django_microsoft_sso
]
```
2. In [Microsoft Entra Administration Center](https://entra.microsoft.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade/quickStartType~/null/sourceType/Microsoft_AAD_IAM) create a multi-tenant app registration and at _Application Register_, retrieve your
Application ID. Navigate to **Certificate & secrets** link, and get the **Client Secret Value**. Add both in your `settings.py`:
```python
# settings.py
MICROSOFT_SSO_APPLICATION_ID = "your Application ID here"
MICROSOFT_SSO_CLIENT_SECRET = "your Client Secret Value here"
MICROSOFT_SSO_SCOPES = ["User.Read.All"]
```
3. Add the callback uri `http://localhost:8000/microsoft_sso/callback/` in your Microsoft Console, on the "Authorized Redirect
URL".
4. Let Django Microsoft SSO auto create users for allowable domains:
```python
# settings.py
MICROSOFT_SSO_ALLOWABLE_DOMAINS = ["contoso.com"]
```
5. In `urls.py` please add the **Django-Microsoft-SSO** views:
```python
# urls.py
from django.urls import include, path
urlpatterns = [
# other urlpatterns...
path(
"microsoft_sso/", include("django_microsoft_sso.urls", namespace="django_microsoft_sso")
),
]
```
6. And run migrations:
```shell
$ 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.
<p align="center">
<img src="docs/images/django_login_with_microsoft_light.png"/>
</p>
---
## Example project
A minimal Django project using this library is included in this repository under `example_microsoft_app/`.
- Read the step-by-step instructions in example_microsoft_app/README.md
- Use it as a reference to configure your own project settings and URLs
## License
This project is licensed under the terms of the MIT license.
Raw data
{
"_id": null,
"home_page": "https://github.com/megalus/django-microsoft-sso",
"name": "django-microsoft-sso",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": "microsoft, django, sso",
"author": "Chris Maillefaud",
"author_email": "chrismaille@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/eb/7f/613b4e3824b279ee84d3ef65149e03169f3844bf034a368a8dd3c6786b6f/django_microsoft_sso-6.0.2.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <img src=\"docs/images/django-microsoft-sso.png\" alt=\"Django Microsoft SSO\"/>\n</p>\n<p align=\"center\">\n<em>Easily integrate Microsoft Authentication into your Django projects</em>\n</p>\n\n<p align=\"center\">\n<a href=\"https://pypi.org/project/django-microsoft-sso/\" target=\"_blank\">\n<img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/django-microsoft-sso\"/></a>\n<a href=\"https://github.com/megalus/django-microsoft-sso/actions\" target=\"_blank\">\n<img alt=\"Build\" src=\"https://github.com/megalus/django-microsoft-sso/workflows/tests/badge.svg\"/>\n</a>\n<a href=\"https://www.python.org\" target=\"_blank\">\n<img alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/django-microsoft-sso\"/>\n</a>\n<a href=\"https://www.djangoproject.com/\" target=\"_blank\">\n<img alt=\"PyPI - Django Version\" src=\"https://img.shields.io/pypi/djversions/django-microsoft-sso\"/>\n</a>\n</p>\n\n## Welcome to Django Microsoft SSO\n\nThis library aims to simplify the process of authenticating users with Microsoft 365 in Django Admin pages,\ninspired by libraries like [django_microsoft_auth](https://github.com/AngellusMortis/django_microsoft_auth)\nand [django-admin-sso](https://github.com/matthiask/django-admin-sso/)\n\n---\n\n### Documentation\n\n* Docs: https://megalus.github.io/django-microsoft-sso/\n\n---\n\n### Install\n\n```shell\n$ pip install django-microsoft-sso\n```\n\n> **Compatibility**\n> - Python 3.11, 3.12, 3.13\n> - Django 4.2, 5.0, 5.1, 5.2\n>\n> Older python/django versions are not supported.\n\n### Configure\n\n1. Add the following to your `settings.py` `INSTALLED_APPS`:\n\n```python\n# settings.py\n\nINSTALLED_APPS = [\n # other django apps\n \"django.contrib.messages\", # Need for Auth messages\n \"django_microsoft_sso\", # Add django_microsoft_sso\n]\n```\n\n2. In [Microsoft Entra Administration Center](https://entra.microsoft.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade/quickStartType~/null/sourceType/Microsoft_AAD_IAM) create a multi-tenant app registration and at _Application Register_, retrieve your\n Application ID. Navigate to **Certificate & secrets** link, and get the **Client Secret Value**. Add both in your `settings.py`:\n\n```python\n# settings.py\n\nMICROSOFT_SSO_APPLICATION_ID = \"your Application ID here\"\nMICROSOFT_SSO_CLIENT_SECRET = \"your Client Secret Value here\"\nMICROSOFT_SSO_SCOPES = [\"User.Read.All\"]\n```\n\n3. Add the callback uri `http://localhost:8000/microsoft_sso/callback/` in your Microsoft Console, on the \"Authorized Redirect\n URL\".\n\n4. Let Django Microsoft SSO auto create users for allowable domains:\n\n```python\n# settings.py\n\nMICROSOFT_SSO_ALLOWABLE_DOMAINS = [\"contoso.com\"]\n```\n\n5. In `urls.py` please add the **Django-Microsoft-SSO** views:\n\n```python\n# urls.py\n\nfrom django.urls import include, path\n\nurlpatterns = [\n # other urlpatterns...\n path(\n \"microsoft_sso/\", include(\"django_microsoft_sso.urls\", namespace=\"django_microsoft_sso\")\n ),\n]\n```\n\n6. And run migrations:\n\n```shell\n$ python manage.py migrate\n```\n\nThat's it. Start django on port 8000 and open your browser in `http://localhost:8000/admin/login` and you should see the\nMicrosoft SSO button.\n\n<p align=\"center\">\n <img src=\"docs/images/django_login_with_microsoft_light.png\"/>\n</p>\n\n---\n\n## Example project\n\nA minimal Django project using this library is included in this repository under `example_microsoft_app/`.\n- Read the step-by-step instructions in example_microsoft_app/README.md\n- Use it as a reference to configure your own project settings and URLs\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Easily add Microsoft Authentication to your Django Projects",
"version": "6.0.2",
"project_urls": {
"Homepage": "https://github.com/megalus/django-microsoft-sso",
"Repository": "https://github.com/megalus/django-microsoft-sso"
},
"split_keywords": [
"microsoft",
" django",
" sso"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cc20b0bbd46887981ef200682ba9caa3cd8b253dc33039777327685474c5059c",
"md5": "1b4bffebc10db2f9eb91bc2cc51bf296",
"sha256": "1fbfad45eaa5dd58683a1a86158476df0db49db5e93c7d295c7805c783a3c6f4"
},
"downloads": -1,
"filename": "django_microsoft_sso-6.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1b4bffebc10db2f9eb91bc2cc51bf296",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 34081,
"upload_time": "2025-09-16T20:31:03",
"upload_time_iso_8601": "2025-09-16T20:31:03.728353Z",
"url": "https://files.pythonhosted.org/packages/cc/20/b0bbd46887981ef200682ba9caa3cd8b253dc33039777327685474c5059c/django_microsoft_sso-6.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "eb7f613b4e3824b279ee84d3ef65149e03169f3844bf034a368a8dd3c6786b6f",
"md5": "f7ac8054c2f637c40799881adc71efa9",
"sha256": "ab831fabf43478a234468b4ab2aa855175c398dc72807f8c5c79702d63560ef7"
},
"downloads": -1,
"filename": "django_microsoft_sso-6.0.2.tar.gz",
"has_sig": false,
"md5_digest": "f7ac8054c2f637c40799881adc71efa9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 24194,
"upload_time": "2025-09-16T20:31:04",
"upload_time_iso_8601": "2025-09-16T20:31:04.612643Z",
"url": "https://files.pythonhosted.org/packages/eb/7f/613b4e3824b279ee84d3ef65149e03169f3844bf034a368a8dd3c6786b6f/django_microsoft_sso-6.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-16 20:31:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "megalus",
"github_project": "django-microsoft-sso",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "django-microsoft-sso"
}