Documentation v0.43.0-rc.21 all versions

Authentication

Starting with 0.40.0, the Obelisk API port denies any request that does not present a valid token. This page explains what is protected, how tokens are issued and configured, and how each client (CLI, REST, Web UI) authenticates.

Authentication is one part of the broader operator/deployment boundary. See Security model for public environment variables, registered secrets, native execution approval, and outbound HTTP policy.

What is protected

Authentication guards the API port (127.0.0.1:5005 by default). A single host-level check runs before any routing of the REST web API, which the CLI and the Web UI use. The gRPC and gRPC-web API was removed in 0.43.

A request without an accepted token is rejected with HTTP 401 Unauthorized.

Webhook HTTP servers authenticate only when server.toml gives them oidc entries or api_auth = true; see Credentials and public servers. A server without credentials serves public HTTP traffic, so it starts only when app.toml lists it in public_http_servers. Do not expose such a server on a public interface without your own protection in front of it.

Local development: server run --dev prints the startup token and lets the internal HTTP server start without configured credentials. The API still requires a token. Credentials configured in server.toml stay enforced.

Tokens

Ephemeral startup token

Every time the server starts it generates a fresh random token, valid until the server shuts down. It is generated even when persistent or environment tokens are configured. Only server run --dev prints it, to standard error, which is the quickest way to get going locally:

API startup token: 6f1c...<token>

Components that call their own server's API can receive this token through an internal secret, so the app needs no operator-supplied token for that purpose.

Persistent tokens

Persistent tokens are configured as SHA-256 hashes of the token text in server.toml. The hashes are not secrets, so the file stays safe to commit to version control. Generate a token and append its hash directly to the server configuration:

export OBELISK_API_TOKEN=$(obelisk generate token --server-config server.toml)

Stdout contains only the token. Without --server-config, an interactive terminal also prints the ready-to-paste hash entry to stderr. Use --json when a program needs both values.

Collect one hash per client and list them, with a comment identifying each:

api.token_hashes = [
  "sha256:...",   # agent
  "sha256:...",   # laptop
]

The plaintext token is printed once and never stored. The server loads api.token_hashes at startup, so adding or revoking a token (deleting its hash line) takes effect only after a restart. The live token-file reload of earlier 0.43 release candidates and its api.token_hashes_loaded and api.token_hashes_changed system events were removed.

OIDC ID tokens

The API can also accept OIDC ID tokens, such as Fly.io machine tokens, from trusted issuers. Each api.oidc entry names an issuer, the required audience, and claims that must match exactly:

[[api.oidc]]
issuer = "https://oidc.fly.io/my-org"
audience = "https://my-app.example.com"
claims = { app_name = "deployer" }

The issuer must be https:// unless its host is loopback, the audience must not be empty, and at least one claim is required, so that not every token from the issuer is accepted. Signing keys are fetched through OIDC discovery and refreshed while the server runs, so issuer key rotation needs no restart. Static tokens are unaffected.

The issuer, audience, and claim values in api.oidc and http_server.<name>.oidc accept ${VAR} and ${VAR:-default} from the server's environment. Missing variables stop startup, and the resolved values must satisfy the same validation rules.

Plaintext token from the environment

A single plaintext token can be injected into the server through --api-token or the environment variable OBELISK_API_TOKEN — the same variable the CLI client uses (see below). This is intended for secret-manager injection at deploy time; do not write the plaintext into a committed server.toml.

export OBELISK_API_TOKEN=<token>
obelisk server run --app-config app.toml --deployment deployment.toml

Use a token generated by obelisk generate token. A plaintext token shorter than 32 characters is still accepted for compatibility, but the server logs a warning when a request first presents it.

The legacy OBELISK__API__TOKEN fallback was removed in 0.43. Use OBELISK_API_TOKEN. Persistent tokens use api.token_hashes; there is no plaintext api.token server key.

Authenticating each client

CLI

Subcommands that talk to the API present the token via their --api-token flag, which falls back to $OBELISK_API_TOKEN. The server accepts the same $OBELISK_API_TOKEN variable, so client and server now share one canonical variable.

export OBELISK_API_TOKEN=<token>
obelisk deployment submit deployment.toml     # picks up $OBELISK_API_TOKEN
obelisk execution list --api-token <token>    # or pass it explicitly, after the subcommand

Tip (local development): because the server and the CLI both accept OBELISK_API_TOKEN, a single generated token can authenticate both sides. With direnv, mint a fresh token per shell in .envrc so the server you start and the CLI you run share it automatically, with no copy-paste of the startup token:

# .envrc
export OBELISK_API_TOKEN=$(obelisk generate token)

REST / curl

Send the token in the Authorization header on every request:

curl -s "http://127.0.0.1:5005/v1/executions" \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer $OBELISK_API_TOKEN"

See API access for the full REST reference.

Web UI

The Web UI (127.0.0.1:8080 by default) calls the REST web API on the API port, so it needs a token too. On the first call that requires authentication it shows an "Authentication required" dialog. Paste any accepted token (the ephemeral startup token, or a persistent one) and continue. The token is kept in the browser tab's session storage, so it persists across reloads but is cleared when the tab closes; if the token stops being accepted you are prompted again.

Summary

SurfacePort (default)Authenticated
REST web API127.0.0.1:5005Yes
Web UI127.0.0.1:8080Yes (prompts for a token)
external webhook server127.0.0.1:9090When configured
internal webhook server127.0.0.1:9091When configured
On this page