Getting started
This guide builds the OAuthMC container locally, starts it, creates a verification ticket, joins with Minecraft, and redeems the code.
Every command runs in a terminal on the host. Each command block is followed by the output you see. Values in angle brackets, like <ticket_id>, change on every run.
Prerequisites#
- Docker Engine
curlandopenssl- Minecraft Java Edition (or the test client in
tests/clients/for local testing without a real Minecraft account)
1. Build the container image#
The prebuilt image at ghcr.io/yellowumbrelladev/oauthmc is not published yet; it ships with the first stable release. Until then, build the image from the crates/oauthmc directory (or pass crates/oauthmc from the monorepo root):
docker build -t oauthmc crates/oauthmcThe build compiles a static Linux musl binary and packages it into a non-root distroless image. It finishes with:
=> => naming to docker.io/library/oauthmc:latest2. Generate an API key and start OAuthMC#
Every key in OAUTHMC_API_KEYS must be at least 32 characters long. Generate a random 48-character hex key:
API_KEY=$(openssl rand -hex 24)
echo "$API_KEY"<48 hex characters>Start the container. Expose port 25565 for Minecraft clients and bind port 8080 to 127.0.0.1 so the HTTP API stays private:
docker run -d --name oauthmc \
-p 25565:25565 \
-p 127.0.0.1:8080:8080 \
-e OAUTHMC_API_KEYS="$API_KEY" \
-e OAUTHMC_PUBLIC_ADDRESS="verify.example.com" \
oauthmc<container id>Check the startup log and the health probe:
docker logs oauthmclevel=info event=listening mc_addr=0.0.0.0:25565 api_addr=0.0.0.0:8080curl -sS http://127.0.0.1:8080/healthz{"ok":true}3. Create a ticket#
Replace HatsuneMiku with the Minecraft Java username you want to verify:
curl -sS -X POST http://127.0.0.1:8080/v1/tickets \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"HatsuneMiku"}'{"address":"verify.example.com","exclusive":false,"expires_at":"2026-11-26T10:32:09Z","id":"tkt_823fc8dac7451029a38794aef229ea24","max_attempts":5,"metadata":null,"mode":"code","name":"HatsuneMiku","status":"pending"}Save the returned id as TICKET_ID:
TICKET_ID="tkt_823fc8dac7451029a38794aef229ea24"4. Join the Minecraft server#
Open Minecraft Java Edition, go to Multiplayer, add 127.0.0.1:25565 (or your OAUTHMC_PUBLIC_ADDRESS), and join.
OAuthMC completes the online-mode login handshake against Mojang's session server and disconnects you with a one-time 8-character code:
Your verification code: N6AN-46TW
Enter it on the website (expires in 15 min).
Never share this code with anyone.You can confirm the ticket moved from pending to joined:
curl -sS "http://127.0.0.1:8080/v1/tickets/$TICKET_ID" \
-H "Authorization: Bearer $API_KEY"{"attempts_left":5,"expires_at":"2026-11-26T10:32:09Z","id":"tkt_823fc8dac7451029a38794aef229ea24","metadata":null,"mode":"code","name":"HatsuneMiku","status":"joined"}GET /v1/tickets/{id} never returns the player's Mojang UUID.
5. Redeem the code#
Send the code from the disconnect screen to POST /v1/tickets/{id}/redeem. Matching ignores case and dashes:
curl -sS -X POST "http://127.0.0.1:8080/v1/tickets/$TICKET_ID/redeem" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"code":"N6AN-46TW"}'{"name":"HatsuneMiku","uuid":"a0c4b8c5-a04f-4a6f-9d02-1dea6154a9f6"}Redeeming consumes the ticket. A second redeem returns 409 Conflict:
{"error":"not_redeemable","message":"ticket cannot be redeemed in its current status","status":"redeemed"}If you send a wrong code before redeeming, OAuthMC returns 422 Unprocessable Entity and decrements attempts_left:
{"attempts_left":4,"error":"wrong_code","message":"verification code does not match"}6. Clean up#
Remove the test container when you finish:
docker rm -f oauthmcoauthmcNext steps#
- Read Integrating OAuthMC to wire code mode or link mode into your backend and UI.
- Read Configuration to tune TTLs, rate limits, MOTD, favicon, and message templates.
- Read Deploying to run OAuthMC with Docker Compose, DNS SRV records, or a TCP proxy.