sculk.network
Nightly Stable docs
OAuthMCnightly · 39a95aaView in Stable docs

Configuration

OAuthMC reads all configuration from OAUTHMC_* environment variables at startup. If any value is invalid or out of range, OAuthMC prints one diagnostic line to stderr and exits with status 2:

text
configuration error: OAUTHMC_API_KEYS must be set with at least one key of at least 32 characters

Boolean variables accept true, false, 1, 0, yes, or no (case-insensitive). Empty or whitespace-only values are treated as unset, except for OAUTHMC_MOTD, where only an empty string falls back to the default.

Listeners and identity#

Variable Default Format / range Purpose
OAUTHMC_API_KEYS (required) Comma-separated strings, each >= 32 characters Bearer tokens for /v1/*. Each distinct key defines an isolated tenant. Whitespace around commas is trimmed and duplicates are removed.
OAUTHMC_MC_ADDR 0.0.0.0:25565 ip:port TCP socket address for the Minecraft listener (IPv4 or [IPv6]:port).
OAUTHMC_API_ADDR 127.0.0.1:8080 (0.0.0.0:8080 in Docker) ip:port TCP socket address for the HTTP API listener. Bind to loopback or a private container network.
OAUTHMC_PUBLIC_ADDRESS (unset) Non-empty string Public Minecraft hostname echoed in address by POST /v1/tickets. Returns null when unset.
OAUTHMC_SESSION_URL https://sessionserver.mojang.com https://... or http://... Mojang session server base URL. Trailing slashes are stripped. Use http:// only for local mocks and tests.

Tickets#

Variable Default Format / range Purpose
OAUTHMC_TICKET_TTL 900 1..=OAUTHMC_MAX_TTL Default ticket lifetime in seconds. Must not exceed OAUTHMC_MAX_TTL.
OAUTHMC_MAX_TTL 3600 1..=86400 Maximum ttl_seconds a platform may request per ticket.
OAUTHMC_MAX_ATTEMPTS 5 1..=OAUTHMC_MAX_ATTEMPTS_CAP Default redeem attempts before a ticket locks. Must not exceed OAUTHMC_MAX_ATTEMPTS_CAP.
OAUTHMC_MAX_ATTEMPTS_CAP 10 1..=100 Maximum max_attempts a platform may request per ticket.
OAUTHMC_EXCLUSIVE false Boolean Default exclusive flag for new tickets. When true, POST /v1/tickets returns 409 name_busy if any open ticket exists for that username across any tenant.
OAUTHMC_MAX_TICKETS 10000 1..=1000000 Global cap on stored tickets, including expired tickets inside their grace period. Returns 503 ticket_limit when full.
OAUTHMC_MAX_TICKETS_PER_KEY min(1000, OAUTHMC_MAX_TICKETS) 1..=OAUTHMC_MAX_TICKETS Per-tenant cap on stored tickets, including expired tickets in grace. Must not exceed OAUTHMC_MAX_TICKETS. Returns 503 ticket_limit when full.
OAUTHMC_EXPIRED_GRACE_SECONDS 300 0..=86400 Seconds an expired ticket stays queryable as expired before the background sweep removes it.

Link mode holds clients on Minecraft 1.21.6 and later in the Configuration state while showing an in-game dialog. If a held-connection limit is reached, OAuthMC falls back to a code-mode disconnect for that join.

Variable Default Format / range Purpose
OAUTHMC_ALLOW_HTTP_LINKS false Boolean Allow http:// in link_url templates. Leave false in production so only https:// URLs are accepted.
OAUTHMC_LINK_HOLD_SECONDS 600 1..=86400 Maximum seconds a link-mode connection stays held in Configuration. Capped by the ticket's remaining TTL.
OAUTHMC_MAX_HELD OAUTHMC_MAX_CONNECTIONS / 2 (128) 0..OAUTHMC_MAX_CONNECTIONS Maximum concurrent held link-mode connections globally. Must be strictly less than OAUTHMC_MAX_CONNECTIONS so held sessions cannot starve code-mode logins or status pings.
OAUTHMC_MAX_HELD_PER_IP 2 0..=10000 Maximum concurrent held link-mode connections per IP bucket (IPv4 /32, IPv6 /64).

Limits and timeouts#

Per-IP limits group IPv4 peers by /32 and IPv6 peers by /64. IPv4-mapped IPv6 addresses (::ffff:a.b.c.d) fold back into their IPv4 /32 bucket.

Variable Default Format / range Purpose
OAUTHMC_MAX_PACKET_LEN 4096 256..=65536 Maximum Minecraft packet payload length in bytes during Handshake and Login.
OAUTHMC_MAX_HANDSHAKE_ADDR_LEN 255 16..=4096 Maximum Handshake server address length in bytes.
OAUTHMC_LOGIN_TIMEOUT_SECONDS 10 1..=120 Overall deadline in seconds for Handshake and Login (including Login Acknowledged in link mode).
OAUTHMC_SESSION_TIMEOUT_SECONDS 5 1..=60 HTTP timeout in seconds for Mojang hasJoined requests.
OAUTHMC_MAX_CONNECTIONS 256 1..=100000 Global concurrent Minecraft TCP connection cap (includes held link-mode connections).
OAUTHMC_MAX_CONNECTIONS_PER_IP 16 1..=10000 Per-IP concurrent Minecraft TCP connection cap (includes held connections).
OAUTHMC_AUTH_RATE_PER_MINUTE 6 1..=100000 Per-IP auth token bucket refill rate per minute, checked after confirming an open ticket exists and before RSA or Mojang calls.
OAUTHMC_AUTH_BURST 3 1..=100000 Per-IP auth token bucket burst size.
OAUTHMC_MAX_SESSION_CALLS 32 1..=10000 Global cap on concurrent outgoing Mojang hasJoined requests. Excess logins are kicked with the rate_limited message.
OAUTHMC_MAX_API_CONNECTIONS 256 1..=100000 Global concurrent HTTP API connection cap.
OAUTHMC_API_HEADER_TIMEOUT_SECONDS 10 1..=120 HTTP API header read timeout in seconds.
OAUTHMC_API_BODY_TIMEOUT_SECONDS 10 1..=120 HTTP API request body read timeout in seconds. Exceeding it returns 408 body_timeout.

Appearance and messages#

Variable Default Format / range Purpose
OAUTHMC_MOTD OAuth§bMC§7 account verification\n§bJoin to get your code Non-empty string Server list description, up to two lines. § formatting codes and \n line breaks pass through to the client.
OAUTHMC_FAVICON Built-in OAuthMC icon Path to a 64x64 PNG (<= 64 KiB) Server list icon, read and base64-encoded at startup.
OAUTHMC_MESSAGES (unset) Path to a JSON file Overrides any subset of the default kick, dialog, and disconnect message templates.

Message templates#

Pass a JSON object file via OAUTHMC_MESSAGES to override any subset of the 14 server templates. Unknown keys or empty strings cause startup to fail with exit status 2.

Default templates:

json
{
  "no_ticket": "No verification is waiting for {name}.\nStart one on the website first.",
  "code": "Your verification code: {code}\nEnter it on the website (expires in {minutes_left} min).\nNever share this code with anyone.",
  "unverified": "Could not verify your Minecraft account.\nMake sure your game is running in online mode and try again.",
  "rate_limited": "Too many verification attempts. Try again in a minute.",
  "dialog_title": "Verify your Minecraft account",
  "dialog_code": "Your code: {code}",
  "link": "Open the verification link in your browser or copy the code above (expires in {minutes_left} min).\nNever share this code or link with anyone.",
  "open_link": "Open link",
  "copy_code": "Copy code",
  "verified": "Your Minecraft account is now verified. You can close the game.",
  "expired": "Your verification ticket has expired. Start a new one on the website.",
  "locked": "Too many incorrect verification codes. Start a new verification on the website.",
  "replaced": "You joined again in another session. Use the newest verification code.",
  "shutdown": "The verification server is shutting down. Please reconnect."
}

Template keys and placeholders#

Templates support four placeholders: {name}, {code}, {link}, and {minutes_left}. Placeholders that do not apply to a given event expand to an empty string.

Key Per-ticket override When shown Available placeholders
no_ticket No Login Disconnect before encryption when no open ticket matches the username. {name} ({minutes_left} is 0)
rate_limited No Login Disconnect when the per-IP auth bucket or OAUTHMC_MAX_SESSION_CALLS is exhausted. {name}, {minutes_left}
unverified Yes Login Disconnect when Mojang hasJoined fails, returns 204, or returns a different username. {name}, {minutes_left}
code Yes Login Disconnect in code mode, code-kick fallback for link mode, or Configuration Disconnect when OAUTHMC_LINK_HOLD_SECONDS expires before ticket TTL. {name}, {code}, {minutes_left}, {link} (on link-mode fallback only)
dialog_title Yes Link-mode Configuration dialog title. {name}, {code}, {link}, {minutes_left}
dialog_code Yes First body line of the link-mode dialog. {name}, {code}, {link}, {minutes_left}
link Yes Second body line of the link-mode dialog. {name}, {code}, {link}, {minutes_left}
open_link Yes Label of the open_url button in the link-mode dialog. {name}, {code}, {link}, {minutes_left}
copy_code Yes Label of the copy_to_clipboard button in the link-mode dialog. {name}, {code}, {link}, {minutes_left}
verified Yes Configuration Disconnect after the platform redeems the ticket. {name}, {code}, {link}, {minutes_left}
expired Yes Configuration Disconnect when the ticket expires or is deleted while held. {name}, {code}, {link} ({minutes_left} is 0)
locked Yes Configuration Disconnect when wrong codes exhaust max_attempts. {code} and {link} are omitted. {name} ({minutes_left} is 0)
replaced Yes Configuration Disconnect on an older held session when the player joins again. {code} and {link} are omitted. {name}, {minutes_left}
shutdown No Configuration Disconnect sent to held clients when OAuthMC receives SIGTERM or SIGINT. {name} ({minutes_left} is 0)

Per-ticket overrides in POST /v1/tickets are limited to 1–512 bytes per string. When multiple open tickets exist for the same player and all belong to the same tenant, OAuthMC applies the newest ticket's overrides. When open tickets span multiple tenants, OAuthMC ignores per-ticket overrides and falls back to the server templates in code mode. See Security model.