{"id":16716275,"url":"https://github.com/rayluo/identity","last_synced_at":"2025-04-23T00:02:31.569Z","repository":{"id":61317502,"uuid":"541305565","full_name":"rayluo/identity","owner":"rayluo","description":"This is an authentication/authorization library optimized for web apps. It provides some higher level APIs built on top of Microsoft's MSAL Python. Read its documentation here: https://identity-library.readthedocs.io","archived":false,"fork":false,"pushed_at":"2025-04-17T07:05:57.000Z","size":135,"stargazers_count":57,"open_issues_count":6,"forks_count":6,"subscribers_count":8,"default_branch":"dev","last_synced_at":"2025-04-17T22:03:26.225Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://identity-library.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rayluo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.MD","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-25T20:48:58.000Z","updated_at":"2025-04-17T07:05:44.000Z","dependencies_parsed_at":"2024-06-10T08:46:22.642Z","dependency_job_id":null,"html_url":"https://github.com/rayluo/identity","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"a8e861f089204321188ece96af43193ee738a609"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":"rayluo/python-project-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayluo%2Fidentity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayluo%2Fidentity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayluo%2Fidentity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayluo%2Fidentity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rayluo","download_url":"https://codeload.github.com/rayluo/identity/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250343925,"owners_count":21415037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T21:12:40.370Z","updated_at":"2025-04-23T00:02:31.531Z","avatar_url":"https://github.com/rayluo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Identity library\n\n\u003c!-- The following summary is reused in, and needs to be in-sync with, the docs/index.rst --\u003e\nThis Identity library is an authentication/authorization library that:\n\n* Suitable for apps that are targeting end users on\n  [Microsoft identity platform, a.k.a. Microsoft Entra ID](https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-overview)\n  (which includes Work or school accounts provisioned through Azure AD,\n  and Personal Microsoft accounts such as Skype, Xbox, Outlook.com).\n* Currently designed for web apps,\n  regardless of which Python web framework you are using.\n* Provides a set of high level API that is built on top of, and easier to be used than\n  [Microsoft's MSAL Python library](https://github.com/AzureAD/microsoft-authentication-library-for-python).\n* Written in Python, for Python apps.\n\n\u003e DISCLAIMER: The code in this repo is not officially supported by Microsoft and is not intended for production use.\n\u003e The intention of this repo is to unblock customers who would like to use a higher level API,\n\u003e 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.\n\u003e Please ensure to fully test any code used from this repository to ensure it works in your environment.\n\n## Scenarios supported\n\n\u003ctable border=1\u003e\n  \u003ctr\u003e\n    \u003cth\u003e\u003c/th\u003e\n    \u003cth\u003eMicrosoft Entra ID\u003c/th\u003e\n    \u003cth\u003eMicrosoft Entra External ID\u003c/th\u003e\n    \u003cth\u003eMicrosoft Entra External ID with Custom Domain\u003c/th\u003e\n    \u003cth\u003eAzure AD B2C\u003c/th\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003cth rowspan=2\u003eApp Registration\u003c/th\u003e\n    \u003ctd\u003e\u003c!-- See https://github.com/github/cmark-gfm/issues/12 --\u003e\n\nFollowing only the step 1, 2 and 3  of this\n[Quickstart: Add sign-in with Microsoft to a Python web app](https://learn.microsoft.com/entra/identity-platform/quickstart-web-app-python-sign-in?tabs=windows)\n\n\u003c/td\u003e\n    \u003ctd\u003e\n\nFollow only the page 1 of this [Tutorial: Prepare your customer tenant ...](https://learn.microsoft.com/entra/external-id/customers/tutorial-web-app-python-flask-prepare-tenant)\n\n\u003c/td\u003e\n    \u003ctd\u003e\n\nComing soon.\n\n\u003c/td\u003e\n    \u003ctd\u003e\n\nFollowing only the step 1 and 2 (including 2.1 and 2.2) of this\n[Configure authentication in a sample Python web app by using Azure AD B2C](https://learn.microsoft.com/azure/active-directory-b2c/configure-authentication-sample-python-web-app?tabs=linux)\n\n\u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003ctd colspan=4\u003e\nAfter app registration, you shall obtain the following information:\n\n* Your app's `client_id`, also known as application ID.\n  (For example, if you are using Entra ID, you may follow this\n  [app registration document](https://learn.microsoft.com/entra/identity-platform/quickstart-register-app)).\n* Your app's credential, which can either be a secret string, or a certificate.\n  (For example, if you are using Entra ID, you may follow this\n  [app credential document](https://learn.microsoft.com/entra/identity-platform/how-to-add-credentials?tabs=client-secret)).\n  The `Identity` library's `client_credential` parameter supports all formats supported by\n  [`msal` library's same name parameter](https://msal-python.readthedocs.io/en/latest/#msal.ClientApplication.params.client_credential).\n* Your app's Redirect URI.\n  You may prepare two, one of them looks like `http://localhost:5000/redirect` for local development,\n  the other looks like `https://your_website.com/redirect` for your production.\n  (For example, if you are using Entra ID, you may follow this\n  [redirect URI document](https://learn.microsoft.com/entra/identity-platform/how-to-add-redirect-uri)).\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003cth\u003eWeb App Sign In \u0026 Sign Out\u003c/th\u003e\n    \u003ctd colspan=4\u003e\n\nBy using this library, it will automatically renew signed-in session when the ID token expires.\n\n* [Sample written in ![Django](https://raw.githubusercontent.com/rayluo/identity/dev/docs/django.webp)](https://github.com/Azure-Samples/ms-identity-python-webapp-django)\n* [Sample written in ![Flask](https://raw.githubusercontent.com/rayluo/identity/dev/docs/flask.webp)](https://github.com/Azure-Samples/ms-identity-python-webapp)\n* [Sample written in ![Quart](https://raw.githubusercontent.com/rayluo/identity/dev/docs/quart.webp)](https://github.com/rayluo/python-webapp-quart)\n* Need support for more web frameworks?\n  [Upvote existing feature request or create a new one](https://github.com/rayluo/identity/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc)\n\n\u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003cth\u003eHow to customize the login page\u003c/th\u003e\n    \u003ctd colspan=4\u003e\n\nThe default login page will typically redirect users to your Identity Provider,\nso you don't have to customize it.\nBut if the default login page is shown in your browser,\nyou can read its HTML source code, and find the how-to instructions there.\n\n\u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003cth\u003eWeb App Calls a web API\u003c/th\u003e\n    \u003ctd colspan=4\u003e\n\nThis library supports:\n\n+ Incremental consent. If the user needs to consent to more permissions,\n  the library will automatically redirect the user to the consent page.\n+ Automatically cache the access token and renew it when needed\n\nThey are demonstrated by the same samples above.\n\n\u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003cth\u003eWeb API Calls another web API (On-behalf-of)\u003c/th\u003e\n    \u003ctd colspan=4\u003e\n\nIn roadmap.\n\n\u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003cth\u003eHow to build the samples above from scratch\u003c/th\u003e\n    \u003ctd colspan=4\u003e\n\nRead our [docs here](https://identity-library.readthedocs.io/en/latest/)\n\n\u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003cth\u003eOther scenarios\u003c/th\u003e\n    \u003ctd colspan=4\u003e\n\n[Upvote existing feature request or create a new one](https://github.com/rayluo/identity/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc)\n\n\u003c/td\u003e\n  \u003c/tr\u003e\n\n\u003c/table\u003e\n\n\n## Installation\n\nThis package is [available on PyPI](https://pypi.org/project/identity/).\nChoose the package declaration that matches your web framework:\n\nNote: Make sure you put \"identity[...]\" in quotes to ensure it works in all terminals.\n\n* Django: `pip install \"identity[django]\"`\n* Flask: `pip install \"identity[flask]\"`\n* Quart: `pip install \"identity[quart]\"`\n\n\n## Versions\n\nThis library follows [Semantic Versioning](http://semver.org/).\nYour project should declare `identity` dependency with proper lower and upper bound.\n\nYou can find the changes for each version under\n[Releases](https://github.com/rayluo/identity/releases).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayluo%2Fidentity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frayluo%2Fidentity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayluo%2Fidentity/lists"}