Python package to get auth token interactively for a public client application using msal and msal-extension for caching.
Project description
msal-bearer
Python package to get authorization token interactively for a msal public client application supporting local cache and refreshing the token.
Usage
from msal_bearer.BearerAuth import BearerAuth
tenantID = "YOUR_TENANT_ID"
client_id = "YOUR_CLIENT_ID"
scope = ["YOUR_SCOPE"]
auth = BearerAuth.get_auth(
tenantID=tenantID,
clientID=client_id,
scopes=scope
)
# Supports requests
response = requests.get("https://www.example.com/", auth=auth)
# and httpx
client = httpx.Client()
response = client.get("https://www.example.com/", auth=auth)
Installing
Clone and install using poetry or install from pypi using pip.
pip install msal_bearer
Alternatives
Other similar packages include https://pypi.org/project/msal-requests-auth/ (for confidential client applications) and https://pypi.org/project/msal-interactive-token-acquirer/ (no caching implemented).
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
msal_bearer-1.1.1.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for msal_bearer-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 260d7c33fe7a61848d88e6e57ab258771cb44ce85c97b42bc04308e8733ea379 |
|
MD5 | e8cca5f4fd5b7080ad83810e9e8ab03f |
|
BLAKE2b-256 | 4a014035e3921c794d2ba484ae7f82f62fabb2fb90557737f5ffbced792529a0 |