
OAuthMC
OAuthMC is a standalone Rust service that verifies a player owns a Minecraft Java Edition account by having them join a Minecraft server. It runs an online-mode Minecraft listener alongside a private HTTP API, requires no database, and lets platforms verify accounts without Microsoft Entra app approval.
How it works#
- Your platform creates a short-lived ticket for a Minecraft username over the HTTP API (
POST /v1/tickets). - The player joins your OAuthMC server in Minecraft Java Edition. OAuthMC authenticates them against Mojang's session server and delivers a single-use 8-character code (
XXXX-XXXX):- Code mode (all supported versions): disconnects the player with the code, which they enter on your platform.
- Link mode (Minecraft 1.21.6+, automatic code-mode fallback on older versions): holds the player in Configuration with an in-game dialog (Open link and Copy code) and disconnects them with a confirmation message once redeemed.
- Your platform redeems the code (
POST /v1/tickets/{id}/redeem) to receive the player's Mojang UUID and canonical username.
sequenceDiagram
participant Platform
participant OAuthMC
participant Player
Platform->>OAuthMC: POST /v1/tickets {name}
OAuthMC-->>Platform: 201 {id, address, expires_at}
Platform-->>Player: Show server address
Player->>OAuthMC: Join in Minecraft (online mode)
OAuthMC-->>Player: Code disconnect or 1.21.6+ dialog
Player->>Platform: Enter code or confirm link in signed-in session
Platform->>OAuthMC: POST /v1/tickets/{id}/redeem {code}
OAuthMC-->>Platform: 200 {uuid, name}Quick start#
ghcr.io/yellowumbrelladev/oauthmc is not published yet; it ships with the first release. Build the container locally from crates/oauthmc (or . if you are already inside that directory):
docker build -t oauthmc crates/oauthmc => => naming to docker.io/library/oauthmc:latestGenerate a 32+ character API key and start OAuthMC (binding port 8080 to loopback so the HTTP API stays private):
API_KEY=$(openssl rand -hex 24)
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>Create a ticket:
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"}Join 127.0.0.1:25565 in Minecraft Java Edition with that account to get your one-time code, then redeem it:
curl -sS -X POST http://127.0.0.1:8080/v1/tickets/tkt_823fc8dac7451029a38794aef229ea24/redeem \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"code":"N6AN-46TW"}'{"name":"HatsuneMiku","uuid":"a0c4b8c5-a04f-4a6f-9d02-1dea6154a9f6"}For the full walkthrough with every step and status check, read Getting started.
Documentation#
- Documentation index and glossary
- Getting started — build, run, join, and redeem end to end
- Integrating OAuthMC — code mode, link mode confirmation pages, polling, errors, SDK, and raw HTTP
- Configuration — every
OAUTHMC_*environment variable and message template - HTTP API — endpoints, schemas, and error codes (OpenAPI spec)
- Deploying — Docker Compose, DNS SRV, TCP proxies, health checks, upgrades, and shutdown
- Security model — threat model, session binding, tenant isolation, rate limits, and cryptography
- Minecraft protocol — version matrix, packet quirks, and Configuration dialogs
- TypeScript SDK — zero-dependency
oauthmcclient for Node.js 18+, Deno, Bun, and Cloudflare Workers - Contributing — building from source, Rust tests, client matrix, and releases
Supported versions#
Verified against real node-minecraft-protocol clients in online mode:
- Code mode: 1.8.9, 1.12.2, 1.16.5, 1.19, 1.19.2, 1.20.1, 1.21.1, and 26.1.
- Link mode: 1.21.6, 1.21.8, 1.21.11, and 26.1 (older clients fall back to code mode).
Protocol 776 (26.2) and 777 (26.3) are implemented from the protocol spec and verified by in-repo integration tests. See Minecraft protocol for details.
License#
OAuthMC is licensed under the MIT License.
OAuthMC is not affiliated with or endorsed by Mojang Studios or Microsoft. Minecraft is a trademark of Mojang Studios.