Metadata-Version: 2.5
Name: zeit.msal
Version: 1.4.1
Summary: Microsoft Azure AD authentication helper for CLI applications
Project-URL: Repository, https://github.com/ZeitOnline/zeit.msal
Project-URL: Changelog, https://github.com/ZeitOnline/zeit.msal/blob/main/CHANGES.md
Author-email: Die ZEIT Online Engineering <zon-backend@zeit.de>
License-File: LICENSE
Requires-Dist: click
Requires-Dist: msal
Description-Content-Type: text/markdown

# 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).

```console
$ 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
```

```python
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:

```python
auth.login_with_refresh_token('myrefreshtoken')
```


# Changelog

## [1.4.1](https://github.com/ZeitOnline/zeit.msal/compare/1.4.0...1.4.1) (2026-10-29)


### Maintenance

* convert the README to Markdown ([b1df810](https://github.com/ZeitOnline/zeit.msal/commit/b1df810bbd0968df2fd00b04cb59b83537719257))
* **deps:** lock file maintenance (uv) ([e5c763e](https://github.com/ZeitOnline/zeit.msal/commit/e5c763e2276a25b116665e100bdfa9201567ce07))
* **deps:** lock file maintenance (uv) ([7e6e75e](https://github.com/ZeitOnline/zeit.msal/commit/7e6e75e937d12efafe95a90b56313470b427c43b))
* **deps:** update pre-commit hook astral-sh/ruff-pre-commit to v0.17.1 ([2fcadec](https://github.com/ZeitOnline/zeit.msal/commit/2fcadec6d21329233e9c43d88f281e90298d6f07))
* **deps:** update pre-commit hook astral-sh/ruff-pre-commit to v0.17.1 ([55b4e3a](https://github.com/ZeitOnline/zeit.msal/commit/55b4e3a4e40b8aeaef6f9cdbb085f4e31f9591e3))
* **deps:** update pre-commit hook pre-commit/pre-commit-hooks to v6.0.0 ([5e3351a](https://github.com/ZeitOnline/zeit.msal/commit/5e3351ae272c9e26e04e5ba2191571139de24a63))
* **deps:** update pre-commit hook pre-commit/pre-commit-hooks to v6.0.0 ([6f9671d](https://github.com/ZeitOnline/zeit.msal/commit/6f9671d4ef6ccb1bcd7a9607e207b7f81b421e21))
* release with Release Please via the shared pypi-release workflow ([61d6ff3](https://github.com/ZeitOnline/zeit.msal/commit/61d6ff3d1ca7206380761e3a2eacdf83b7b7fe03))
* release with Release Please via the shared pypi-release workflow ([845b0cd](https://github.com/ZeitOnline/zeit.msal/commit/845b0cd61073c5ef8c7ac4edf339c97006482d39))

## 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
