OAuth
Let users sign in with their OmegaCases account. Create an app on the Developer Dashboard first.
Step 1 — Redirect the user
Build a URL with your client_id, a redirect_uri, and the scope you need.
Example
const url = new URL("https://omegacases.com/oauth/authorize")
url.searchParams.set("client_id", "YOUR_CLIENT_ID")
url.searchParams.set("redirect_uri", "https://yourapp.com/callback")
url.searchParams.set("scope", "read_id,read_username")
url.searchParams.set("state", crypto.randomUUID())
window.location.href = url.toString()Step 2 — Handle the callback
After the user authorizes, they're redirected to your redirect_uri with query params including a token.
Callback URL example
https://yourapp.com/callback ?token=a3f9... &user_id=uuid-here &username=player1 &state=your-state-value
Parse it
const p = new URLSearchParams(window.location.search)
const token = p.get("token") // store this!
const userId = p.get("user_id")
const username = p.get("username")
const state = p.get("state") // verify matches what you sentStore the token — it's how you make future API calls without asking the user again.
Scopes
ScopeWhat it allows
read_idUser UUID — returned in callbackread_usernameUsername — returned in callbackread_balanceBalance — returned in callback and /api/oauth/mespend_balanceDeduct balance, credited to app owner via /api/oauth/spendbuy_listingBuy marketplace listings via /api/oauth/listings/buywrite_casesOpen cases on behalf of user via /api/oauth/cases/opennotifySend in-app notifications via /api/oauth/notify