Microsoft Azure AD authentication helper for CLI applications
Project description
Helper to authenticate against Microsoft Azure AD and store the resulting tokens for commandline applications.
Usage
Run interactively to store a refresh token in the cache
Use in e.g. automated tests to retrieve an ID token from the cache (which automatically refreshes it if necessary).
$ msal-token --client-id=myclient --client-secret=mysecret \ --cache-url=file:///tmp/msal.json login Please visit https://login.microsoftonline.com/... # Perform login via browser def test_protected_web_ui(): auth = zeit.msal.Authenticator( 'myclient', 'mysecret', 'file:///tmp/msal.json') http = requests.Session() http.headers['Authorization'] = 'Bearer %s' % auth.get_id_token() r = http.get('https://example.zeit.de/') assert r.status_code == 200
Alternatively, retrieve the refresh token after interactive login, and use that in tests:
auth.login_with_refresh_token('myrefreshtoken')
zeit.msal changes
1.2.1 (2024-03-28)
Dilligently close file handles
1.2.0 (2024-03-21)
Preserve query parameters in redis url
1.1.0 (2021-07-28)
Add get_access_token method, make scopes configurable
Implement redis cache
1.0.0 (2021-07-23)
Initial release
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
Built Distribution
File details
Details for the file zeit.msal-1.2.1.tar.gz
.
File metadata
- Download URL: zeit.msal-1.2.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 989738829099eaf6d3521b62582f7ac891868e5f052f4ddaa526b5f54bc3cc3b |
|
MD5 | 8c4b9d4bc2eeb32488b526fb56adbff2 |
|
BLAKE2b-256 | 2e375216b9a19ac4c8e88ae1a94e8844bd5f1c9446577e2bc502f2b49bb22d64 |
File details
Details for the file zeit.msal-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: zeit.msal-1.2.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce1b61fa871e3735c6ef5f08624f232e75dd2af9f5baa896fe84ed93be03ed2d |
|
MD5 | 02547f51b6ea8684b607bac34ac97e51 |
|
BLAKE2b-256 | d62890a669f37d47cfd5c833a67761cdc1dde37cd15ef4066cfc7cb1d6f5a727 |