Metadata-Version: 2.4
Name: wristband-python-m2m-auth
Version: 0.1.0
Summary: SDK for integrating your Python application with Wristband for machine-to-machine (M2M) authentication. Handles token acquisition and caching.
Author-email: Wristband <support@wristband.dev>
License-Expression: MIT
Project-URL: Homepage, https://wristband.dev
Project-URL: Repository, https://github.com/wristband-dev/python-m2m-auth
Project-URL: Documentation, https://docs.wristband.dev
Keywords: api,auth,authentication,authorization,m2m,machine-to-machine,multi-tenant,multi-tenancy,oauth,oauth2,oidc,sdk,secure,security,wristband
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Security
Classifier: Development Status :: 4 - Beta
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.24.0
Provides-Extra: dev
Requires-Dist: setuptools>=61; extra == "dev"
Requires-Dist: pytest<9.0.0,>=8.2.0; extra == "dev"
Requires-Dist: pytest-cov<6.0.0,>=5.0.0; extra == "dev"
Requires-Dist: pytest-httpx>=0.21.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: mypy>=1.10.0; extra == "dev"
Requires-Dist: flake8<7.0.0,>=6.0.0; extra == "dev"
Requires-Dist: flake8-pyproject>=1.2.0; extra == "dev"
Requires-Dist: pip-audit>=2.0.0; extra == "dev"
Requires-Dist: bandit>=1.7.0; extra == "dev"
Requires-Dist: build>=0.10.0; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: isort>=5.12.0; extra == "dev"
Dynamic: license-file

# Wristband Machine-to-Machine (M2M) Authentication SDK for Python

Wristband provides enterprise-ready auth that is secure by default, truly multi-tenant, and ungated for small businesses.

- Website: [Wristband Website](https://wristband.dev)
- Documentation: [Wristband Docs](https://docs.wristband.dev/)

For detailed setup instructions and usage guidelines, visit the project's GitHub repository.

- [Python M2M Auth SDK - GitHub](https://github.com/wristband-dev/python-m2m-auth)


## Details

This SDK enables Wristband machine-to-machine (M2M) OAuth2 clients to securely retrieve, cache, and refresh access tokens in Python applications. It is supported for Python 3.10+ and provides both synchronous and asynchronous clients to fit any framework (Django, FastAPI, etc.). Key functionalities encompass the following:

- Fetching an access token from Wristband using the OAuth2 client credentials grant.
- Caching the access token in memory for the duration of its validity.
- Automatically refreshing the token when it expires or is nearing expiration.
- Optionally refreshing the token proactively in the background at a fixed interval.
- Clearing the cached token on demand (e.g. after receiving a 401 from a downstream API).

You can learn more about how M2M authentication works in Wristband in our documentation:

- [Machine-to-machine Integration Pattern](https://docs.wristband.dev/docs/machine-to-machine-integration)

## Questions

Reach out to the Wristband team at <support@wristband.dev> for any questions regarding this SDK.
