TokenBroker

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

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.