Authentication Configuration Runbook
Configure authentication modes, personal access tokens, OAuth providers, JWT secrets, token lifetimes, and sign-up controls.
Overview
Section titled “Overview”This runbook covers configuring and managing authentication for Everruns.
Authentication Modes
Section titled “Authentication Modes”1. No Authentication (Development)
Section titled “1. No Authentication (Development)”Use for local development when authentication isn’t needed:
export DEPLOYMENT_GRADE=devexport AUTH_MODE=noneAll requests will be allowed with full admin access. none is refused outside the dev deployment grade; omitting AUTH_MODE does not enable unauthenticated production.
If you later restart the same database with AUTH_MODE=admin or AUTH_MODE=full,
startup revokes personal access tokens owned by the seeded anonymous admin user so
a token minted in no-auth development cannot remain privileged after authentication
is enabled.
2. Admin Mode (Simple Development)
Section titled “2. Admin Mode (Simple Development)”Use for local development with basic access control:
export AUTH_MODE=adminexport AUTH_ADMIN_EMAIL=admin@example.comexport AUTH_ADMIN_PASSWORD=your-secure-passwordexport AUTH_JWT_SECRET=$(openssl rand -hex 32)Only the admin user can authenticate.
3. Full Authentication (Production)
Section titled “3. Full Authentication (Production)”Use for production deployments:
export AUTH_MODE=fullexport PUBLIC_APP_URL=https://your-domain.comexport AUTH_JWT_SECRET=$(openssl rand -hex 32)
# Optional: Configure OAuthexport AUTH_GOOGLE_CLIENT_ID=your-google-client-idexport AUTH_GOOGLE_CLIENT_SECRET=your-google-client-secretexport AUTH_GITHUB_CLIENT_ID=your-github-client-idexport AUTH_GITHUB_CLIENT_SECRET=your-github-client-secretEnvironment Variables Reference
Section titled “Environment Variables Reference”Core Settings
Section titled “Core Settings”| Variable | Required | Description |
|---|---|---|
AUTH_MODE |
Required outside dev grade |
none, admin, full, or external. Unset resolves to none, which is allowed only at dev grade. |
PUBLIC_APP_URL |
For OAuth | Public app origin used to derive auth callback URLs |
AUTH_BASE_URL |
No | Override callback base URL when it differs from PUBLIC_APP_URL + API_PREFIX |
AUTH_LOGIN_ORIGIN |
No | Trusted remote origin hosting /login; set identically for server and UI runtimes |
AUTH_JWT_SECRET |
For admin/full | JWT signing secret (min 32 chars recommended) |
Admin Mode Settings
Section titled “Admin Mode Settings”| Variable | Required | Description |
|---|---|---|
AUTH_ADMIN_EMAIL |
Yes (admin mode) | Admin user email |
AUTH_ADMIN_PASSWORD |
Yes (admin mode) | Admin user password |
JWT Settings
Section titled “JWT Settings”| Variable | Required | Description |
|---|---|---|
AUTH_JWT_ACCESS_TOKEN_LIFETIME |
No | Access token lifetime in seconds (default: 900) |
AUTH_JWT_REFRESH_TOKEN_LIFETIME |
No | Refresh token lifetime in seconds (default: 2592000) |
Device-bound sessions
Section titled “Device-bound sessions”Browser sign-ins support
Device Bound Session Credentials
(DBSC) with no configuration. In a browser that implements it, currently
Chrome, the sign-in response offers registration, the browser creates a key
in its secure hardware, and the server stores the public key with the
session’s refresh token. The browser then drops the 30-day refresh_token
cookie and renews the short-lived access_token cookie itself, through
POST /v1/auth/dbsc/refresh, with a proof signed by that key.
A refresh token copied from such a browser is refused, and a copied access
token works only until it expires (AUTH_JWT_ACCESS_TOKEN_LIFETIME). Browsers
without DBSC keep the refresh cookie and POST /v1/auth/refresh as before.
Requirements: HTTPS, and a reverse proxy that forwards
Secure-Session-Registration, Secure-Session-Challenge,
Secure-Session-Response and Sec-Secure-Session-Id unchanged. The
registration path is relative, so serving the API under a prefix such as
/api works. Signing out, or deleting the user’s refresh tokens (see
Force Logout User), ends a device-bound session at its
next renewal.
Feature Toggles
Section titled “Feature Toggles”| Variable | Required | Description |
|---|---|---|
AUTH_DISABLE_PASSWORD |
No | Set to true to disable password login |
AUTH_DISABLE_SIGNUP |
No | Set to true to disable user registration |
Google OAuth
Section titled “Google OAuth”| Variable | Required | Description |
|---|---|---|
AUTH_GOOGLE_CLIENT_ID |
For Google OAuth | Google OAuth client ID |
AUTH_GOOGLE_CLIENT_SECRET |
For Google OAuth | Google OAuth client secret |
AUTH_GOOGLE_REDIRECT_URI |
No | Custom redirect URI |
AUTH_GOOGLE_ALLOWED_DOMAINS |
No | Comma-separated allowed email domains |
GitHub OAuth
Section titled “GitHub OAuth”| Variable | Required | Description |
|---|---|---|
AUTH_GITHUB_CLIENT_ID |
For GitHub OAuth | GitHub OAuth client ID |
AUTH_GITHUB_CLIENT_SECRET |
For GitHub OAuth | GitHub OAuth client secret |
AUTH_GITHUB_REDIRECT_URI |
No | Custom redirect URI |
Common Tasks
Section titled “Common Tasks”Generate JWT Secret
Section titled “Generate JWT Secret”# Using OpenSSLopenssl rand -hex 32
# Using Pythonpython3 -c "import secrets; print(secrets.token_hex(32))"Verify Authentication is Working
Section titled “Verify Authentication is Working”# Check auth config endpointcurl http://localhost:9300/api/v1/auth/config
# Should return:# {"mode":"none","password_auth_enabled":false,"oauth_providers":[],"signup_enabled":false}
# For admin mode:curl -X POST http://localhost:9300/api/v1/auth/login \ -H "Content-Type: application/json" \ -d '{"email":"admin@example.com","password":"your-password"}'Create Personal Access Token
Section titled “Create Personal Access Token”# Login first to get access tokenTOKEN=$(curl -s -X POST http://localhost:9300/api/v1/auth/login \ -H "Content-Type: application/json" \ -d '{"email":"user@example.com","password":"password"}' | jq -r '.access_token')
# Create personal access tokencurl -X POST http://localhost:9300/api/v1/auth/personal-access-tokens \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"name":"my-token"}'
# Read-only token: add "scopes": ["read"]curl -X POST http://localhost:9300/api/v1/auth/personal-access-tokens \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"name":"ci-reader","scopes":["read"]}'
# Response includes the full token - save it, it's shown only onceOmitting scopes creates a full-access token (["*"]). A read-only token
gets 403 insufficient_scope on anything outside read access. See
Token access.
Revoke Personal Access Token
Section titled “Revoke Personal Access Token”curl -X DELETE http://localhost:9300/api/v1/auth/personal-access-tokens/{token_id} \ -H "Authorization: Bearer $TOKEN"Force Logout User
Section titled “Force Logout User”Delete their refresh tokens from database:
DELETE FROM refresh_tokens WHERE user_id = 'user-uuid-here';Troubleshooting
Section titled “Troubleshooting”“Authentication required” when AUTH_MODE=none
Section titled ““Authentication required” when AUTH_MODE=none”- Verify
AUTH_MODEenvironment variable is set correctly - Restart the server after changing environment variables
JWT Validation Fails
Section titled “JWT Validation Fails”- Ensure
AUTH_JWT_SECREThasn’t changed - Check token hasn’t expired
- Verify the token is for the correct environment
OAuth Redirect Fails
Section titled “OAuth Redirect Fails”- Verify
AUTH_BASE_URLmatches the OAuth app configuration, or thatPUBLIC_APP_URLderives the expected{PUBLIC_APP_URL}/apibase - Check that redirect URI in provider matches
{AUTH_BASE_URL}/v1/auth/callback/{provider}or{PUBLIC_APP_URL}/api/v1/auth/callback/{provider} - If you set
AUTH_BASE_URL, ensure it already includes your REST API prefix (default:/api) - Ensure client ID and secret are correct
Password Login Returns Unauthorized
Section titled “Password Login Returns Unauthorized”- In admin mode: check
AUTH_ADMIN_EMAILandAUTH_ADMIN_PASSWORDmatch - In full mode with password disabled: check
AUTH_DISABLE_PASSWORDisn’t set - Verify user exists and password is correct
Database Migration
Section titled “Database Migration”Authentication tables are included in the base schema and auto-applied on server startup.
No manual migration step is required. To check migration status:
# Via admin containerdocker run --rm -e DATABASE_URL="$DATABASE_URL" everruns-admin migrate-infoHealth Check
Section titled “Health Check”The /health endpoint shows current auth mode:
curl http://localhost:9300/health# {"status":"ok","version":"0.2.0","auth_mode":"None"}Agent Discovery Endpoints
Section titled “Agent Discovery Endpoints”The server publishes public documents so an AI agent that only knows the origin can find the MCP endpoint and work out how to authenticate before it has any credentials:
| Path | Contents |
|---|---|
/llms.txt |
What the server offers and where to start: MCP endpoint, auth.md, REST API, OpenAPI, docs |
/auth.md |
How to obtain credentials: OAuth 2.1 with dynamic client registration for the MCP endpoint, and personal access tokens for the REST API |
/.well-known/mcp/server-card.json |
MCP Server Card (SEP-1649): server identity, transport, capabilities, and where its OAuth metadata lives |
/.well-known/api-catalog |
API catalog (RFC 9727): the REST API with its OpenAPI document, and the MCP endpoint |
/.well-known/oauth-protected-resource |
Root copy of the MCP endpoint’s protected resource metadata (RFC 9728), for clients that probe the bare path |
/robots.txt, /sitemap.xml |
Keep crawlers out of the console, allow the documents above, declare Content Signals |
All are generated from the running configuration rather than hardcoded, so a self-hosted deployment describes itself:
- URLs come from
AUTH_BASE_URL/BASE_URL(orPUBLIC_APP_URLplusAPI_PREFIX), the same value used for OAuth callbacks and the MCP resource binding. Set them to the public origin, not an internal container address, or the documents will advertise URLs an agent cannot reach. - Content follows
AUTH_MODE. UnderAUTH_MODE=nonethe documents state that no credentials are required instead of describing an OAuth flow that is not enforced. - The server card
versionandserverInfo.versionare the running server’s release version, the same value/healthreports. A release updates them with the binary.
Reverse proxy configuration (required)
Section titled “Reverse proxy configuration (required)”/auth.md, /llms.txt, /robots.txt, and /sitemap.xml sit at the server
root, so a deployment that puts the UI on / must route these paths to the
server explicitly. Without the rule the request falls through to the UI and
returns its 404, and the document is unreachable even though the server serves
it. The proxy also owns two behaviours of / itself: a Link header pointing
at the discovery documents, and Accept: text/markdown answered with
/llms.txt, since the console renders nothing without JavaScript.
The bundled local proxy,
Railway proxy, and
Docker Compose stack
already include it. For a custom proxy,
add these rules next to wherever /.well-known/* is routed:
handle /.well-known/* { reverse_proxy server:9000}@agent_docs path /auth.md /llms.txt /robots.txt /sitemap.xmlhandle @agent_docs { reverse_proxy server:9000}@agent_markdown { path / header Accept *text/markdown*}handle @agent_markdown { header Vary Accept rewrite * /llms.txt reverse_proxy server:9000}handle { header / +Link "</.well-known/api-catalog>; rel=\"api-catalog\", </llms.txt>; rel=\"describedby\"; type=\"text/markdown\"" reverse_proxy ui:9305}nginx (documents only):
location ~ ^/(auth\.md|llms\.txt|robots\.txt|sitemap\.xml)$ { proxy_pass http://server:9000;}Verify after deploying:
curl -fsS https://your-host/auth.md | head -1 # expect "# auth.md"curl -fsS -H 'Accept: text/markdown' https://your-host/ | head -1 # expect "# Everruns"curl -fsSI https://your-host/ | grep -i '^link' # expect rel="api-catalog"curl -fsS https://your-host/.well-known/mcp/server-card.jsonA response of text/html rather than text/markdown means the UI answered and
the proxy rule is missing.
Security Best Practices
Section titled “Security Best Practices”- Never commit secrets: Use environment variables or secret management
- Rotate JWT secret: Change
AUTH_JWT_SECRETperiodically (invalidates all tokens) - Use HTTPS: Always use HTTPS in production for OAuth callbacks
- Limit OAuth domains: Use
AUTH_GOOGLE_ALLOWED_DOMAINSto restrict access - Monitor personal access token usage: Track
last_used_atfor suspicious activity - Set token expiration: Use shorter
AUTH_JWT_ACCESS_TOKEN_LIFETIMEfor higher security