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
- Your game asks REAN for a code.
- You show the code and the address (and a QR code of
verification_uri_completeif you can). - The player opens reanstudios.com/activate, signs in, checks the code and allows your game.
- Meanwhile your game polls the token endpoint; it receives tokens as soon as the player allows.
1. Request a code
POST
https://api.reanstudios.com/api/oauth/device| Name | Type | Description |
|---|---|---|
client_idrequired | string | Your client id. |
scope | string | Space-separated scopes. |
{
"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
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| Answer | What to do |
|---|---|
authorization_pending | Keep waiting; poll again after interval seconds. |
slow_down | You polled too fast: add 5 seconds to your interval. |
access_denied | The player declined. Stop. |
expired_token | The code expired. Offer to start again. |
| 200 with tokens | Signed 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