TokenBroker Wiki
TokenBroker is a small Azure Function that owns OAuth token renewal for services whose access tokens expire too fast for their callers to manage. Callers (today: Muse's mail tooling) call the function with a static function key; the function reads the provider's refresh token and client secret from Azure Key Vault, mints a fresh access token, and proxies the API call. Secrets never live in caller configuration, in this repo, or in chat.
Why it exists: Zoho access tokens live one hour. The Muse credential store could not renew them (every call failed with 401 INVALID_OAUTHTOKEN about an hour after each reconnect), so Zoho mail kept going dark. TokenBroker moves renewal into code we control, with logs when a provider refuses a refresh.
Sections
- Setup Guide: set up your own TokenBroker from
scratch, step by step, then add providers as needed.
- Setup Guide: Adding a Provider: the full walkthrough for teaching the broker a new service.
- Token Setup: the general pattern, the security
rules, and the checklist for adding a new provider.
- Token Setup: Azure Foundation: the Azure resources everything stands on, how they were provisioned, and how the function is deployed.
- Token Setup: Zoho: the complete Zoho Mail setup, step by step, including the one-time refresh-token bootstrap.
Live resources (2026-11-28)
| Thing | Value |
|---|---|
| Subscription | Example subscription (tenant: |
| Resource group | rg-tokenbroker, West US 2 |
| Function App | tokenbroker-example, https://tokenbroker-example.azurewebsites.net |
| Runtime | .NET 11 isolated worker, Flex Consumption (Linux) |
| Key Vault | kv-tokenbroker-example (RBAC authorization on) |
| Storage | sttokenbrokerexample |
Status: deployed and working. Zoho Mail accounts and search verified end to end on 2026-11-28. Next step: point the Muse zoho-mail connector and its watches at the function.