Agora

Config 1.x is a release candidate. npm's latest tag still installs 0.x, so install these docs' version from the rc tag:

npm i @adonis-agora/config@rc
node ace configure @adonis-agora/config

The same goes for every @adonis-agora/* package these docs install: add @rc, and where a page says node ace add, install with @rc first and then run node ace configure. On 0.x? Read the 0.x 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 needed

The 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.

config/config.ts (the server)
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',
  }),
})
config/config.ts (an app)
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:

ClaimMeaning
partitionthe app whose configuration the token may read
environment (optional)the environment; default the control plane's
capabilitiesconfig:read, optionally config:secrets:read
expevery stream opened with the token closes at expiry

Capabilities

CapabilityGrants
config:readevery endpoint; secret values come back masked
config:secrets:readsecret values, unmasked (config:read is still required)
config:writereserved 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):

GrantedCovers
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') // false

An 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.

config/config.ts (the server)
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'],
      },
    },
  }),
})
config/config.ts (an app)
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

SituationAnswer
no token, or the verifier rejects it401 { "error": "unauthorized" }
the token lacks the capability403 { "error": "token lacks the config:read capability" }
the token expired mid-streamthe stream closes; the tenant reconnects with a fresh token
the token is rejected with 401the tenant calls the source's reset(), fetches a new token and retries once

Nothing about the refusal says whether the app exists.

On this page

Partner

Your product as the official integration for Config, right here.

Become a partner →