What it does
This example walks through the complete Grantex authorization lifecycle using the Python SDK:- Register an agent with
calendar:readandemail:sendscopes - Authorize in sandbox mode — the sandbox API key auto-approves and returns a
codeimmediately (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.readaction - 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:Expected output
Environment variables
| Variable | Default | Description |
|---|---|---|
GRANTEX_URL | http://localhost:3001 | Base URL of the Grantex auth service |
GRANTEX_API_KEY | sandbox-api-key-local | API key. Use a sandbox key for auto-approval |
Source code
The full source is inexamples/quickstart-py/main.py.