msal
The Microsoft Authentication Library (MSAL) for Python library enables your app to access the Microsoft Cloud by supporting authentication of users with Microsoft Azure Active Directory accounts (AAD) and Microsoft Accounts (MSA) using industry standard OAuth2 and OpenID Connect.
Decision gist · record as of 2026-08-14
Yes. MSAL is actively maintained, widely used (top 1000 PyPI packages), has no known vulnerabilities, and is the officially recommended authentication library for Microsoft identity integration. Its low install friction, permissive MIT license, and explicit token cache control make it the right choice for any application needing Microsoft identity authentication.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- You must register your application with the Microsoft identity platform and obtain a client ID before using MSAL.
- Low install friction with a pure-wheel distribution.
- Actively maintained with a release 77 days ago and recent commits; the repository has 967 stars and is not archived.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions; you must include a copy of the license and copyright notice.
last release 2026-05-29 (77 days) · last repo commit 2026-08-12 · 967 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 223,049,387 downloads/mo, #185 on PyPI
Alternatives
Verify before relying
pip install msal
from msal import PublicClientApplication
app = PublicClientApplication(
"your_client_id",
authority="https://login.microsoftonline.com/tenant")
result = app.acquire_token_by_device_flow(scopes=["User.Read"])
if "access_token" in result:
print(result["access_token"])- Whether the token cache automatically handles refresh in all authentication flows or only specific ones.
- Performance characteristics and scalability limits for high-volume token acquisition scenarios.
- Detailed support matrix for different Microsoft identity service endpoints and account types.
What it is and what it does
MSAL for Python is Microsoft's official authentication library for integrating applications with the Microsoft identity platform. It abstracts OAuth2 and OpenID Connect protocol details, allowing you to authenticate users with Microsoft Entra ID, Microsoft Accounts, and Azure AD B2C, then obtain access tokens to call Microsoft Graph or custom APIs.
The library separates public and confidential client application types and provides explicit token cache management to reduce authentication round-trips. You create an application instance once, check the cache for existing accounts, attempt silent token acquisition, and fall back to interactive flows only when needed. It depends on requests, PyJWT, and cryptography for HTTP communication, JWT handling, and cryptographic operations.
Use it for
- Web applications requiring users to sign in with their Microsoft Entra ID or Microsoft Account credentials.
- Desktop or mobile apps needing to authenticate users and call Microsoft Graph API endpoints.
- Service-to-service authentication where your application acts as a confidential client with its own credentials.
- Multi-tenant applications serving organizations with different Azure AD tenants.
- Applications migrating from ADAL Python that need a modern OAuth2/OpenID Connect implementation.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
MSAL is actively maintained, widely used (top 1000 PyPI packages), has no known vulnerabilities, and is the officially recommended authentication library for Microsoft identity integration. Its low install friction, permissive MIT license, and explicit token cache control make it the right choice for any application needing Microsoft identity authentication.
Install
msal on PyPI
Before you install
Low install friction with a pure-wheel distribution. Actively maintained with a release 77 days ago and recent commits; the repository has 967 stars and is not archived.
You must register your application with the Microsoft identity platform and obtain a client ID before using MSAL.
License in practice
MIT license permits commercial and private use with minimal restrictions; you must include a copy of the license and copyright notice.
Quickstart
pip install msal
from msal import PublicClientApplication
app = PublicClientApplication(
"your_client_id",
authority="https://login.microsoftonline.com/tenant")
result = app.acquire_token_by_device_flow(scopes=["User.Read"])
if "access_token" in result:
print(result["access_token"])
Verify before relying
- Whether the token cache automatically handles refresh in all authentication flows or only specific ones.
- Performance characteristics and scalability limits for high-volume token acquisition scenarios.
- Detailed support matrix for different Microsoft identity service endpoints and account types.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesrequestsPyJWTcryptography |
| Maintenance | Actively maintained 77 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 223,049,387 / month, #185 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9 |
Evidence: msal-1.37.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “microsoft authentication library python”
- msalMSAL for Python handles OAuth2 and OpenID Connect authentication with…
- identityProvides a high-level authentication and authorization API for Python…
- msgraph-coreProvides core HTTP client infrastructure for the Microsoft Graph…
Give your agent the search over MCP, or paste the wish link into any chat.
More Security packages
Provides Python bindings to the FreeDesktop.org Secret Service API for securely storing and retrieving passwords and secrets through GNOME Keyring, KWallet, or KeePassXC.
joserfc implements JOSE standards (JWS, JWE, JWK, JWT, and related RFCs) for signing, encrypting, and managing JSON-based cryptographic tokens in Python.
Authlib provides a complete implementation of OAuth 1.0, OAuth 2.0, and OpenID Connect 1.0 for building both authentication clients and servers, with built-in support for JWS, JWK, JWA, and JWT standards.
Provides low-level CFFI bindings to the official Argon2 password hashing algorithm for use by libraries and applications that need direct access to Argon2 without higher-level abstractions.
ADAL for Python authenticates applications with Azure Active Directory to obtain tokens for accessing Azure AD-protected resources.
Install only if maintaining existing code that already depends on it, and plan a migration.
Disables the CVE-2023-47248 security vulnerability in older PyArrow versions by patching unsafe deserialization behavior when imported.
See also identity · msal-extensions · streamlit-msal · microsoft-agents-authentication-msal · fastapi-azure-auth · azure-identity · coze-workload-identity · redis-entraid · msrestazure