You're viewing the docs for Config 0.x. The latest is 1.x (rc). Go to the 1.x (rc) docs
Authentication
One token contract for every Agora control plane — urn:agora:config, a partition and capabilities.
A tenant presents a bearer token. The control plane verifies it and derives the app, the
environment and the capabilities from the token, never from the request. This is the same contract
as @adonis-agora/durable and @adonis-agora/flags: one authkit service tenant client can hold
several resources.
With authkit
Register the app in authkit as a service tenant (the client_credentials grant) for the resource
urn:agora:config, with the scopes it needs:
resource: urn:agora:config
scope: config:read
config:secrets:read # only where secret values are neededThe control plane verifies tokens locally against the issuer's JWKS, found through discovery
(/.well-known/openid-configuration → jwks_uri). No hard-coded token URL, no call per request.
import { authkitTenantVerifier } from '@adonis-agora/authkit-client'
import { defineConfig } from '@adonis-agora/config'
export default defineConfig({
topology: 'control-plane',
// The helper returns exactly this package's TenantVerifier shape.
verifyTenant: authkitTenantVerifier({
issuer: env.get('AUTHKIT_ISSUER'),
resource: 'urn:agora:config',
}),
})import { authkitTenantToken } from '@adonis-agora/authkit-client'
export default defineConfig({
topology: 'tenant',
tenant: {
url: env.get('CONFIG_URL'),
partition: 'streaming',
token: authkitTenantToken({
issuer: env.get('AUTHKIT_ISSUER'),
clientId: env.get('AUTHKIT_CLIENT_ID'),
clientSecret: env.get('AUTHKIT_CLIENT_SECRET'),
resource: 'urn:agora:config',
}),
},
})Claims the control plane reads:
| Claim | Meaning |
|---|---|
partition | the app whose configuration the token may read |
environment (optional) | the environment; default the control plane's |
capabilities | config:read, optionally config:secrets:read |
exp | every stream opened with the token closes at expiry |
Capabilities
| Capability | Grants |
|---|---|
config:read | every endpoint; secret values come back masked |
config:secrets:read | secret values, unmasked (config:read is still required) |
config:write | reserved for writes through the admin API |
Wildcards are accepted. A * segment matches one segment, and a trailing * matches whatever
follows, including nothing (config:secrets:* also covers config:secrets):
| Granted | Covers |
|---|---|
config:* | every config capability, secrets included |
config:secrets:* | config:secrets:read |
* | everything |
Nothing else is implied: config:read never grants config:secrets:read. To check a capability the
same way in your own code, use capabilityAllows:
import { capabilityAllows } from '@adonis-agora/config'
capabilityAllows(['config:*'], 'config:secrets:read') // true
capabilityAllows(['config:read'], 'config:secrets:read') // falseAn app's identity in the token is also what the audit trail records: the actor is the token's act
claim when the call is an RFC 8693 exchange, else its sub.
Without authkit
One shared secret per app. The tenant names its app with x-config-app; the secret proves it.
import { sharedSecretVerifier } from '@adonis-agora/config'
export default defineConfig({
topology: 'control-plane',
verifyTenant: sharedSecretVerifier({
partitions: {
streaming: env.get('CONFIG_SECRET_STREAMING'),
billing: {
secret: env.get('CONFIG_SECRET_BILLING'),
environment: 'staging',
capabilities: ['config:read', 'config:secrets:read'],
},
},
}),
})tenant: { url, partition: 'streaming', token: env.get('CONFIG_SECRET_STREAMING') }The default capability set is ['config:read']. A secret is never readable just because the app is
authenticated.
The verifier: three forms
verifyTenant is top level and accepts the same three forms in every Agora lib:
// a function
verifyTenant: async ({ token }) => verifyMyWay(token)
// a class instance (or a class, constructed with no arguments)
verifyTenant: new MyVerifier()
// a lazy import: keeps the OIDC library out of the module graph when unused
verifyTenant: () => import('./config_verifier.js')A lazy module may export the verifier as default, verify or tenantVerifier. The answer is
checked strictly: { partition: string, environment?: string, capabilities: string[] } or null.
A malformed answer (or the old durable { tenant } shape) is refused with a clear error, never
accepted.
Refusals
| Situation | Answer |
|---|---|
| no token, or the verifier rejects it | 401 { "error": "unauthorized" } |
| the token lacks the capability | 403 { "error": "token lacks the config:read capability" } |
| the token expired mid-stream | the stream closes; the tenant reconnects with a fresh token |
| the token is rejected with 401 | the tenant calls the source's reset(), fetches a new token and retries once |
Nothing about the refusal says whether the app exists.