What it does
This example walks through the complete Grantex authorization lifecycle using the Python SDK:
- Register an agent with
calendar:read and email:send scopes
- Authorize in sandbox mode — the sandbox API key auto-approves and returns a
code immediately (no redirect required)
- Exchange the code for a signed RS256 grant token
- Verify the token offline against the local JWKS endpoint
- Log an audit entry recording a
calendar.read action
- Revoke the token and confirm revocation via an online verify check
Prerequisites
- Python 3.9+
- Docker (Docker Desktop or Docker Engine with Compose)
Run
Start the local Grantex stack from the repository root:
In a separate terminal, run the example:
Expected output
Environment variables
Source code
The full source is in examples/quickstart-py/main.py.Last modified on July 14, 2026