Skip to main content

Configure server authentication

Handler supports four auth types for configured servers:
  • bearer tokens
  • API keys
  • mTLS client certificates
  • OAuth2 client credentials
Add a server from the CLI with the matching auth flags, or define the auth block manually in servers.toml.

Bearer tokens

CLI:
TOML:
For one-off local setups you can also use a literal value, but environment variables are safer for anything shared.

API keys

CLI:
Handler sends API keys in X-API-Key by default. TOML with the default header:
TOML with a custom header:

mTLS

CLI:
TOML:
Handler checks that the certificate and key files exist before use, and verifies private key permissions.

OAuth2 client credentials

CLI:
TOML:
Handler fetches the access token with the OAuth2 client credentials grant, applies it as a bearer token on requests, and refreshes it when it expires. Use an HTTPS token endpoint so client credentials are protected in transit.