Skip to main content

Helper to authenticate against Microsoft Azure AD and store the resulting tokens for commandline applications.

Usage

  1. Run interactively to store a refresh token in the cache

  2. 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 1.4.0 (2026-08-26)

Changes

  • Replace deprecated decode_id_token (msal)

1.3.1 (2025-02-18)

Changes

  • Update to non-deprecated msal search API (msal)

zeit.msal changes

1.4.0 (unreleased)

  • Nothing changed yet.

1.3.0 (2025-02-17)

  • Update to current msal API when requesting an ID token

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

Metadata

Release files for zeit.msal 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zeit.msal 1.4.0
File Size Uploaded
zeit_msal-1.4.0.tar.gz 29.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zeit.msal 1.4.0
File Interpreter ABI Platform
zeit_msal-1.4.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 35.6 kB

Release files / zeit_msal-1.4.0.tar.gz

Download URL zeit_msal-1.4.0.tar.gz
Size 29.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7913d56b63ad2400dc3820cc2fa73a98c348f6765a0c1ce2749fcf5df13c42f7
BLAKE2b-256 checksum
How to use checksums
087e65f4e7462008c46991bf23fb95762e4ed826b0181b407d7f7b1b932f1085
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / zeit_msal-1.4.0-py2.py3-none-any.whl

Download URL zeit_msal-1.4.0-py2.py3-none-any.whl
Size 6.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
423dd9e3efd0eb2e05074e09de8fbe3c0f1af38baab271b615af719a3574d9ff
BLAKE2b-256 checksum
How to use checksums
1331a1eac0189f020e886f0f92397eb7ef122ef70cef73122e47e8922297a868
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.4.0 This release

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page