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 auth token interactively for a msal public client application and cache it locally.
Usage
tenantID = "YOUR_TENANT_ID"
client_id = "YOUR_CLIENT_ID"
scope = ["YOUR_SCOPE"]
auth = BearerAuth.get_bearer_token_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)
THe auth object can be used as an auth for both requests and httpx.
Installing
Install using pip or poetry from pypi.
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-0.2.0.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for msal_bearer-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1994f2bf27cf9fb3a421925659c3644780a4a5030efcb6c9b63a55bf6aa05bd7 |
|
MD5 | 1fa5b6572ca7db10832dbe76b88df03a |
|
BLAKE2b-256 | bb46f3c2afe5b1cf0d72703e9f47483c8b8d112f9df20311bca34fd17f812968 |