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.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
zeit.msal-1.2.0.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for zeit.msal-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d2b6cf7c9ae8b8a2662be3ddf26e68bebeb29363575ce9841e57671f75bb9b3 |
|
MD5 | 63bbe179d6e672491c8dac505c7fd072 |
|
BLAKE2b-256 | a17189e435669eb0236bd9b36f8f64c9f5fb1cbeb82f914e705f1e6869e5a7fc |