Skip to main content

Django Microsoft SSO

Easily integrate Microsoft Authentication into your Django projects

PyPI Build PyPI - Python Version PyPI - Django Version

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 and django-admin-sso


Documentation


Install

$ pip install django-microsoft-sso

Compatibility

  • Python 3.11, 3.12, 3.13, 3.14
  • Django 5.0, 5.1, 5.2, 6.0

Older python/django versions are not supported.

Configure

  1. 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
]
  1. In Microsoft Entra Administration Center 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:
# 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"]
  1. Add the callback uri http://localhost:8000/microsoft_sso/callback/ in your Microsoft Console, on the "Authorized Redirect URL".

  2. Let Django Microsoft SSO auto create users for allowable domains:

# settings.py

MICROSOFT_SSO_ALLOWABLE_DOMAINS = ["contoso.com"]
  1. 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")
    ),
]
  1. 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.


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.

Metadata

Release files for django-microsoft-sso 7.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-microsoft-sso 7.1.1
File Size Uploaded Provenance
django_microsoft_sso-7.1.1.tar.gz 531.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-microsoft-sso 7.1.1
File Interpreter ABI Platform
django_microsoft_sso-7.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 568.8 kB

Release files / django_microsoft_sso-7.1.1.tar.gz

Download URL django_microsoft_sso-7.1.1.tar.gz
Size 531.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f07ed0cca4c903145bf56b9b90562ec363956a11a05243b8ae9d5719fc9f9df7
BLAKE2b-256 checksum
How to use checksums
524b8f251e1ea71805ca7ff1bb682bac4f8a8bc61719f9c5fd74ca8a9db259e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.

Transparency log

Release files / django_microsoft_sso-7.1.1-py3-none-any.whl

Download URL django_microsoft_sso-7.1.1-py3-none-any.whl
Size 37.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e0bc8aad42893e74a68b42d2a57b35b0b8d1cd90c012afc88d51bc281b69234
BLAKE2b-256 checksum
How to use checksums
8b4b3dd6c32e2e5078b4f998557788bc16927edda77deb1661ea996b31351549
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.

Transparency log

Security for django-microsoft-sso 7.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_microsoft_sso-7.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page