Skip to main content

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.

Project description

Identity library

This Identity library is an authentication/authorization library that:

  • Suitable for apps that are targeting end users on Microsoft identity platform, a.k.a. Microsoft Entra ID (which includes Work or school accounts provisioned through Azure AD, and Personal Microsoft accounts such as Skype, Xbox, Outlook.com).
  • Currently designed for web apps, regardless of which Python web framework you are using.
  • Provides a set of high level API that is built on top of, and easier to be used than Microsoft's MSAL Python library.
  • Written in Python, for Python apps.

DISCLAIMER: The code in this repo is not officially supported by Microsoft and is not intended for production use. The intention of this repo is to unblock customers who would like to use a higher level API, before such an API has been migrated to an Microsoft library with official support. Migration of this API to official support is not guaranteed and is not currently on the MSAL roadmap. Please ensure to fully test any code used from this repository to ensure it works in your environment.

Scenarios supported

Microsoft Entra ID Microsoft Entra External ID Microsoft Entra External ID with Custom Domain Azure AD B2C
App Registration

Following only the step 1, 2 and 3 of this Quickstart: Add sign-in with Microsoft to a Python web app

Follow only the page 1 of this Tutorial: Prepare your customer tenant ...

Coming soon.

Following only the step 1 and 2 (including 2.1 and 2.2) of this Configure authentication in a sample Python web app by using Azure AD B2C

Web App Sign In & Sign Out

By using this library, it will automatically renew signed-in session when the ID token expires.

How to customize the login page

The default login page will typically redirect users to your Identity Provider, so you don't have to customize it. But if the default login page is shown in your browser, you can read its HTML source code, and find the how-to instructions there.

Web App Calls a web API

This library supports:

  • Incremental consent. If the user needs to consent to more permissions, the library will automatically redirect the user to the consent page.
  • Automatically cache the access token and renew it when needed

They are demonstrated by the same samples above.

Web API Calls another web API (On-behalf-of)

In roadmap.

How to build the samples above from scratch

Read our docs here

Other scenarios

Upvote existing feature request or create a new one

Installation

This package is available on PyPI. Choose the package declaration that matches your web framework:

  • Django: pip install identity[django]
  • Flask: pip install identity[flask]
  • Quart: pip install identity[quart]

Versions

This library follows Semantic Versioning. Your project should declare identity dependency with proper lower and upper bound.

You can find the changes for each version under Releases.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

identity-0.9.1.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

identity-0.9.1-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file identity-0.9.1.tar.gz.

File metadata

  • Download URL: identity-0.9.1.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for identity-0.9.1.tar.gz
Algorithm Hash digest
SHA256 dce3d69762f6fe3bd0fcff91e65f59f22df5a04a0c2f4d48516a243394abe7ee
MD5 026dab05141d74d80e9c96a70295960d
BLAKE2b-256 fdaf2bdd23db8eed75feda4b2be3c92edd1c8dd4da2d31e94441a729ce1891fb

See more details on using hashes here.

File details

Details for the file identity-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: identity-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for identity-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ec3b4f24736a2b9154a8f5139f2bb79551132b956b61b4b748f2a4ae67ce435f
MD5 ba227c02bfcb81ec47996dabbd0c3b6e
BLAKE2b-256 84cadaae74c0a87bbb48d07d256794dbff47e764286151143290a0a1b71bd718

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page