identity
This is an authentication/authorization library, currently optimized for web apps. It provides some higher level APIs built on top of Microsoft's MSAL Python.
What it is and what it does
Identity is a wrapper around Microsoft's MSAL Python library that exposes a simpler, higher-level API for authenticating users in Python web applications against Microsoft identity platforms (Entra ID, Azure AD B2C, and variants). It handles session management, token renewal, incremental consent flows, and access token caching automatically, reducing the boilerplate needed to integrate Microsoft authentication into Flask, Django, or Quart apps.
The library is designed for web apps and currently supports sign-in/sign-out workflows and calling downstream web APIs with automatic token refresh. It is not officially supported by Microsoft and carries an explicit disclaimer recommending full testing before any production use. The package is in Beta status and has not seen a release since 2025-07-07, though the repository remains active.
Use it for:
- Add Microsoft Entra ID sign-in to a Python Flask or Django web app without writing low-level OAuth2 token handling code.
- Implement Azure AD B2C authentication in a Python web application with automatic session renewal and consent management.
- Build a web app that calls a downstream Microsoft-protected API on behalf of a signed-in user, with automatic token caching and refresh.
- Migrate from direct msal usage to a higher-level abstraction when building multi-tenant web apps targeting Microsoft identity providers.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a high-level authentication and authorization API for Python web apps integrating with Microsoft Entra ID, Azure AD B2C, and related Microsoft identity platforms, built on top of the MSAL library.
Yes, if you are building a Python web app that needs Microsoft Entra ID or Azure AD B2C authentication and are willing to accept the non-production disclaimer and aging maintenance status. The low install friction and permissive license make it a reasonable choice for reducing boilerplate, but verify thoroughly in your environment and monitor the repository for updates. Not recommended for production systems requiring official vendor support.
Install
identity on PyPI
pip
pip install identityuv
uv add identitypoetry
poetry add identityInstalling identity
Before you install
Low install friction with a pure-Python wheel distribution. Maintenance status is aging—the last release was in 2025-07-07—but the repository remains active with recent commits and no archived status. The package carries an explicit disclaimer that it is not officially supported by Microsoft and not intended for production use.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute the package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install "identity[flask]"
from identity import Identity
identity = Identity(client_id="your-client-id", client_credential="your-secret")
Requires app registration with Microsoft Entra ID or Azure AD B2C to obtain client_id and credentials; a redirect URI must be configured in your identity provider.
Verify before relying
- Whether the package's high-level API meaningfully reduces boilerplate compared to direct msal use in typical web app scenarios.
- Current production readiness and stability given the aging maintenance status and explicit non-production disclaimer.
- Support timeline and likelihood of migration to official Microsoft support, as mentioned in the disclaimer.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — msal, requests |
| Maintenance | aging — 403 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 224,318/month — #9,234 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: identity-0.11.0-py3-none-any.whl
Keywords: identity, auth, authentication, authorization
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
azure-identity-brokerExtends Azure Identity to enable authentication…
permissive · top 15,000 on PyPI
fastapi-azure-authAdds Azure Entra ID (formerly Azure AD)…
permissive · top 15,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
streamlit-msalAdds Microsoft Authentication Library (MSAL)…
unclear · top 15,000 on PyPI
adalADAL for Python authenticates applications with…
permissive · top 1,000 on PyPI
microsoft-agents-authentication-msalProvides MSAL-based authentication for…
permissive · top 15,000 on PyPI
redis-entraidProvides Entra ID (Azure Active Directory)…
unclear · top 5,000 on PyPI
azure-identityProvides Microsoft Entra ID token-based…
unclear · top 1,000 on PyPI
msal-extensionsProvides secure, platform-specific token cache…
permissive · top 1,000 on PyPI
msgraph-sdkPython client library for calling Microsoft…
permissive · top 5,000 on PyPI