End-to-end demo of the core Grantex authorization lifecycle using the Python SDK with zero framework dependencies.
- Registers an agent with
calendar:readandemail:sendscopes - Initiates authorization in sandbox mode (auto-approved, no consent UI)
- Exchanges the authorization code for a grant token (JWT)
- Verifies the token offline using the local JWKS endpoint
- Logs an audit entry for a simulated calendar read
- Revokes the token and confirms revocation
- Python 3.9+
- Docker (for the local Grantex stack)
# Start the local Grantex stack (from repo root)
docker compose up -d
# Run the example
cd examples/quickstart-py
pip install -r requirements.txt
python main.pyAgent registered: ag_01... did:grantex:ag_01...
Auth request: areq_01...
Sandbox auto-approved, code: 01J...
Grant token received, grantId: grnt_01...
Scopes: calendar:read, email:send
Token verified offline:
principalId: test-user-001
agentDid: did:grantex:ag_01...
scopes: calendar:read, email:send
Audit entry logged: aud_01...
Token revoked.
Post-revocation verify: revoked
Done! Full authorization lifecycle complete.
| Variable | Default | Description |
|---|---|---|
GRANTEX_URL |
http://localhost:3001 |
Auth service base URL |
GRANTEX_API_KEY |
sandbox-api-key-local |
API key (sandbox mode) |