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

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.4.0.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zeit_msal-1.4.0-py2.py3-none-any.whl (6.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file zeit_msal-1.4.0.tar.gz.

File metadata

  • Download URL: zeit_msal-1.4.0.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for zeit_msal-1.4.0.tar.gz
Algorithm Hash digest
SHA256 7913d56b63ad2400dc3820cc2fa73a98c348f6765a0c1ce2749fcf5df13c42f7
MD5 8e53eca7528461c06d54086a4eb8e07c
BLAKE2b-256 087e65f4e7462008c46991bf23fb95762e4ed826b0181b407d7f7b1b932f1085

See more details on using hashes here.

File details

Details for the file zeit_msal-1.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: zeit_msal-1.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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}

File hashes

Hashes for zeit_msal-1.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 423dd9e3efd0eb2e05074e09de8fbe3c0f1af38baab271b615af719a3574d9ff
MD5 724750f13c1249fcdb0940ec1f4138bf
BLAKE2b-256 1331a1eac0189f020e886f0f92397eb7ef122ef70cef73122e47e8922297a868

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.4.0 This release

2 files

1.3.1

2 files

1.3.0

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

1 file

1.0.0

1 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