Skip to main content

What it does

This example walks through the complete Grantex authorization lifecycle using the TypeScript SDK:
  1. Register an agent with calendar:read and email:send scopes
  2. Authorize in sandbox mode — the sandbox API key auto-approves and returns a code immediately (no redirect required)
  3. Exchange the code for a signed RS256 grant token
  4. Verify the token offline against the local JWKS endpoint
  5. Log an audit entry recording a calendar.read action
  6. Revoke the token and confirm revocation via an online verify check

Prerequisites

  • Node.js 18+
  • 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-ts/src/index.ts.
Last modified on July 14, 2026