Games and consoles (device code)

Show a short code; the player enters it on their phone or PC at reanstudios.com/activate. No keyboard or browser needed in your game.

How it works

  1. Your game asks REAN for a code.
  2. You show the code and the address (and a QR code of verification_uri_complete if you can).
  3. The player opens reanstudios.com/activate, signs in, checks the code and allows your game.
  4. Meanwhile your game polls the token endpoint; it receives tokens as soon as the player allows.

1. Request a code

POSThttps://api.reanstudios.com/api/oauth/deviceapplication/x-www-form-urlencoded
NameTypeDescription
client_idrequiredstringYour client id.
scopestringSpace-separated scopes.
Response
{
  "device_code": "rdc_…",
  "user_code": "BCDF-GHJK",
  "verification_uri": "https://reanstudios.com/activate",
  "verification_uri_complete": "https://reanstudios.com/activate?code=BCDF-GHJK",
  "expires_in": 600,
  "interval": 5
}

Codes use 20 consonants only (no vowels, so no accidental words, and no look-alike characters) and expire after 10 minutes.

2. Poll for tokens

bash
curl -X POST https://api.reanstudios.com/api/oauth/token \
  -d grant_type=urn:ietf:params:oauth:grant-type:device_code \
  -d device_code=rdc_… \
  -d client_id=rean_xxxxxxxxxxxxxxxxxxxxxxxx
AnswerWhat to do
authorization_pendingKeep waiting; poll again after interval seconds.
slow_downYou polled too fast: add 5 seconds to your interval.
access_deniedThe player declined. Stop.
expired_tokenThe code expired. Offer to start again.
200 with tokensSigned in.

All SDKs do the polling for you:

Get Game Instance → Get Subsystem (Rean Subsystem) → Sign In With Device
   On Code   → show "Go to {VerificationUri} and enter {UserCode}"
   On Done   → bSuccess ? continue : show Error