Azure AD B2C
Simplified Python SDK for verifying AD B2C-issued JWTs
Usage
import aad
token = "..." # JWT to verify
tenant = "..." # B2C tenant (as in `"{tenant}.b2clogin.com/{tenant}..."`)
app_id = "..." # ClientID of app registered in the B2C tenant
policy = "B2C_1_..." # policy (aka user flow) name
await aad.authorize(token, tenant, app_id, policy)
# {
# "idp": "...",
# "aud": "...",
# ... # other JWT fields
# ... # fields configured in B2C
# }
FastAPI dependency
pip install aad[fastapi]
from fastapi import FastAPI
import aad
Claims = aad.claims(tenant, app_id, policy)
app = FastAPI()
@app.get("...")
def get(claims: Claims):
...
Disclaimer
The JWT decoding part is heavily inspired by azure-ad-verify-token, but with an async interface
Metadata
Release files for aad 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aad-0.1.5.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aad-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / aad-0.1.5.tar.gz
| Download URL | aad-0.1.5.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5416780f2ac9ccd7972cce8c2c6a5e75e70df7aa0c983f30c8ea50b4bd028a83
|
|
BLAKE2b-256 checksum How to use checksums |
25094bbe3cb1dd5d2527ab47830eb4d3eb9d307209da6ce088a534dfe0a5bf41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.6
|
Release files / aad-0.1.5-py3-none-any.whl
| Download URL | aad-0.1.5-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b7d831cb516f8e5c52ad9fe301737425bc1f980b8c12b08bd9bb4bcd6bd6ac6
|
|
BLAKE2b-256 checksum How to use checksums |
ade02495208fe6b9fbd05f178597d8aa29ed1a8fae459e8858679718ccc1b536
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.6
|