Choosing an auth type
A provider has oneauth_type. Pick the row that matches how the upstream
expects to be called:
Static credentials — bearer, API key, basic, custom — are sent as-is on every
call. OAuth 2.0 providers exchange their credentials for an access token,
cache it until shortly before it expires, and refresh it for you. A bearer
provider can do the same with its own token endpoint, see below.
Bearer from a key exchange
Some APIs hand out a long-lived key per user and expect it to be traded for a short-lived bearer at a token endpoint of their own — not an OAuth grant, just a POST with the key in a header. Keepauth_type: bearer and add the endpoint
to auth_config:
The request carries no body. The key is the provider’s
token — the stored one
(auth_secret: { "token": "…" }), or the user’s own supplied at runtime (see
below), which is the usual arrangement. Exchanged bearers are cached per key
until five minutes before they expire (five minutes when the endpoint reports
no expiry), concurrent calls share one exchange, and a bearer the upstream
rejects with a 401 is dropped and exchanged once more before the call fails.
A 401 from the token endpoint itself is an authentication failure — the key
is unknown or revoked — and a scheduled workflow that hits it is paused for
new credentials rather than retried. A runtime entry that already carries an
access_token is sent as-is, with no exchange.
OAuth 2.0 grants
The grant is declared insideauth_config as grant_type. Three are
supported:
Client credentials — machine-to-machine, and the default when a token URL
and client secret are present. Use it for your own API.
expires_in minus a
minute, concurrent calls share one token request, and a failed exchange
surfaces as the provider’s error rather than a generic transport failure.
Per-user credentials at runtime
Any provider, whatever itsauth_type, can also take credentials per end
user. Your backend supplies them when it mints the user’s session, keyed by
provider id:
client_secret and the token
URL comes from the provider. A runtime token or access_token short-circuits
the OAuth exchange entirely and is sent as a bearer. The optional base_url
points that user’s calls at a different host — staging versus production, or
a per-tenant instance.
To switch host and keep the credentials stored on the provider, send the
entry with base_url alone — { "PROVIDER_ID": { "base_url": "https://…" } }.
An entry that does carry credentials replaces the stored ones for that user.
The override is applied to every call that user makes — HTTP tools and MCP
connections alike, in chat and in workflow runs — and the calls leave from
the platform, not from the user’s browser. A staging host that only admits
known IP addresses must therefore admit the platform’s egress addresses too;
otherwise every call fails before it reaches your application, typically as
a bare 403 Forbidden page from the edge (nginx, a WAF) rather than your
API’s own error body. To tell the two apart, a failed HTTP tool call names
the host that answered: HTTP 403 from staging.api.example.com: ….
GET /v1/tools-auth lists every provider with the credential fields it
expects, so you can build the map without reading provider configuration:
The built-in Sidenet API provider is keyed by name rather than id:
sidenet-api, with the user’s own Sidenet API key as its token. It has no
stored credential, so a user without an entry cannot call its tools. See
MCP server.
Credentials persist on the user, not the session: a later mint inherits
them, and unattended workflow runs and schedules read the same store. They
are injected on every call made in that user’s name — POST /v1/chat, the
run_agent MCP tool, POST /v1/agents/{id}/run, POST /v1/copilots/{id}/run,
POST /v1/workflows/{id}/run, POST /v1/tools/{toolId}/execute, dashboard
refreshes, schedule fires and a schedule’s
delivery call
alike — with nothing further to send.
Rotate or remove them with PATCH /v1/users/{userId}. See
Authentication.
Requiring a per-user credential
By default a user who has no entry for a provider falls back to the provider’s stored configuration — the right behaviour for a shared service account, the wrong one when the stored credential is privileged and every user is supposed to act as themselves. Setrequire_runtime_auth: true on
the provider (on POST /v1/tool-providers or PATCH /v1/tool-providers/{id})
and the fallback is gone: a call whose runtime credentials carry no entry for
that provider fails with no credential for provider X before any stored
secret is read. An entry that holds only base_url or cache_scope counts as
no credential. The failure is an authentication failure — a scheduled workflow
that hits it is paused for new credentials rather than retried — and
GET /v1/tools-auth marks such providers with required: true so your
backend knows which entries a mint must always carry. One caller is exempt:
a SideNet system key (the Studio’s own key, or a session minted from it) may
still use the stored credential, which is how the Studio tests such a tool;
it never reaches another organisation’s credential.
The same rule applies, without any flag, to a shared platform
provider called from an org
that does not own it: the owner’s stored credential serves another org’s
calls only once the owner has
granted
the provider to that org. Until then the call fails the same way, and
GET /v1/tools-auth lists the provider as required there.
How this composes with session tokens
Your backend fillstools_auth at mint time. The browser holds a session
token that refers to those credentials and cannot read, change or replace
them — anything credential-shaped a page sends alongside a session token is
ignored. Under the organization API key, a runtimeAuth map in the request
body is honoured and wins over the stored credentials, which is how a
server-side integration tests a user’s access. See
Embedding securely.
Runtime credentials also decide who shares a cached tool result. A walk
fetched with organization credentials is shared across the org; one fetched
with a user’s credentials is private to that user unless your backend
asserts a tenant-wide
cache_scope. See Working with large APIs.Connected apps
Catalogue toolkits — Gmail, Slack, and the rest — authenticate through connected accounts rather than credentials you hold:- Org-scoped — one account connected by an admin, used by every user.
- User-scoped — each end user connects their own account. The agent gets
list_connectionsto see what is connected andconnect_toolkitto start the sign-in, which returns a redirect URL for the user.
Storage and masking
- Secrets go to the vault.
client_secret,password,refresh_token, tokens and keys are stored encrypted in Supabase Vault; the provider row keeps only a reference. Non-secret settings — grant type, token URL, the key exchange’stoken_header/token_field/expires_field, scope, client id, username, header names — stay on the row. - Never returned on read. Every read returns
auth_configwith secret values replaced by***ENCRYPTED***and ahas_vault_secretflag. Header names incustomconfigurations are visible; their values are masked. - Preserved on edit. A PATCH merges
auth_configrather than replacing it, and any value equal to***ENCRYPTED***is skipped, so a read → edit → save round-trip in your own tooling never blanks a secret. Omitauth_secretto keep the current vault entry. A plaintext value sent for a key that lives in the vault is moved into the vault, not left to be shadowed. - Masked in logs. Outbound requests log the URL, method, body length, a
200-character body preview and the headers with
Authorizationand any header whose name containstoken,secret,api-key,apikeyor ends in-keyreduced to a length and an eight-character preview — a gateway key indefault_headersincluded. Per-user credentials are never logged, never returned by any endpoint, and never part of a cache key.