Skip to main content

zeit.msal

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')

Changelog

1.4.1 (2026-10-29)

Maintenance

  • convert the README to Markdown (b1df810)
  • deps: lock file maintenance (uv) (e5c763e)
  • deps: lock file maintenance (uv) (7e6e75e)
  • deps: update pre-commit hook astral-sh/ruff-pre-commit to v0.17.1 (2fcadec)
  • deps: update pre-commit hook astral-sh/ruff-pre-commit to v0.17.1 (55b4e3a)
  • deps: update pre-commit hook pre-commit/pre-commit-hooks to v6.0.0 (5e3351a)
  • deps: update pre-commit hook pre-commit/pre-commit-hooks to v6.0.0 (6f9671d)
  • release with Release Please via the shared pypi-release workflow (61d6ff3)
  • release with Release Please via the shared pypi-release workflow (845b0cd)

1.4.0 (2026-08-26)

  • Replace deprecated decode_id_token (msal)

1.3.1 (2025-02-18)

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

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.1

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.1
File Size Uploaded Provenance Actions
zeit_msal-1.4.1.tar.gz 22.2 kB Without provenance Details for zeit_msal-1.4.1.tar.gz

Built distribution (wheel)

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

Total release size: 28.7 kB

Release files / zeit_msal-1.4.1.tar.gz

Download URL zeit_msal-1.4.1.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e29d8c180b8ad2a14cb626c367bd689cf095c98b49bc630dc95d0f0a65816d26
BLAKE2b-256 checksum
How to use checksums
ff4bbbdb1e3cface9434baa44ef14b765a794af7dc91f877827d52595c3f606b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL zeit_msal-1.4.1-py2.py3-none-any.whl
Size 6.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
4b6be192180e32176264fe5969f6ee96d7a20fa6aaad5f8f2752aa7a97c2697e
BLAKE2b-256 checksum
How to use checksums
65c42e1301317e99f60ed1e84eceb572a4b37c273e57188720e3fa455dd7a58b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for zeit.msal 1.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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