Supercell id API proxy for retrieving the account token. Compatible with Clash Royale and Brawl Stars (tested only for clash royale, for brawl stars compatibility you need to change the scroll
parameter to laser
).
This repo is meant to be deployed to a production server so that your app can track scid tokens using a web API. If you just need to get the scid token, read the "Usage without installation" section.
- Specify your MySQL database credentials in the method
getDatabaseConnection
located in filesystem/ApiRequest.php
. - Specify the array of api users in the
system/Config.php
file. Don't forget to update theIDTYPE_MAX_VALUE
variable.
-
Perform a
POST
request tohttps://ingame.id.supercell.com/api/account/login
.In the body of your post request there should be following parameters:
email
,lang
,game
andenv
.The
lang
parameter can be e.g.en
orru
(It affects only the web interface language).Specify the
env
parameter asprod
(for production).For Clash Royale, specify the
game
parameter to bescroll
, for Brawl Stars:laser
.Important: The values should be serialized as URL parameters but sent via POST body, not as JSON. Example:
email=example@gmail.com&lang=en&game=scroll&env=prod
. -
The supercell server should respond with
{"ok": true}
. If so, you will receive an email with the pin code shortly. -
Perform a
POST
request tohttps://ingame.id.supercell.com/api/account/login.validate
with theemail
andpin
parameters in thePOST
body. Just as in the first request, we need to serialize these parameters as if they were URL parameters. -
The supercell server should respond with the following json-object:
{ "ok": true, "data": { "isValid": true, "isBound": true } }
-
Perform a
POST
request tohttps://ingame.id.supercell.com/api/account/login.confirm
with exactly the sameemail
andpin
parameters as in the last request (serialized the same way). -
The supercell server should respond with:
{ "ok": true, "data": { "scid": "<YOUR SCID TOKEN>", "pid": "XXXXX-YYYYY" // XXXXX is the tag's high component, YYYYY is the tag's low component } }