Using escs OAuth for sign in

How to do backend to backend player profile integration

The goal is to offer the best possible user experience for the players. Therefore it would be great if we could skip the escs registration process for players. It is possible if you have a backend, where you have your player's profile data - so if you know your players.

In this case, you can integrate directly with our OAuth service and eliminate the need for the players to go through the registration process in the escs in order to play in tournaments and socialize.

The integration is extremely simple - you have to create an OAuth app (basically press 2 buttons) and make one method call in your

Integration steps

Go to the main game screen in client.escs.io and press the "Create oAuth App" button - like in the screenshot below

The screen below opens. You can leave the App name as it is and enter some text in the description. Leave the "Secret key" field blank as well - we will create it for you automatically. Do not lose this key. Store it somewhere safe! It cannot be recovered if lost. In the Game API Url field, enter the endpoint, where the escs account system will get the player's profile data, using the access token that you will send - read the next part about this. This endpoint must validate the access token and respond with the profile data.

Press the "Create App" button. You get the following response:

You need to save and copy the keys above: the secret key and the application id. You cannot recover them later.

After that, you can proceed to the "Supporting user login using the game account" section for your plugin. And please read about the "Access token" below.

Access token

escs gets the access token from the game via the corresponding plugin. When a user wants to log into escs using their game account, they press the corresponding button on the escs main screen, and then you will receive a callback in your game, where you can show some permissions request dialog to user and obtain the access token from your game backend. This token along with the list of permissions should be sent to the escs plugin. How the game gets this access token from your backend is completely up to you.

After that, the escs backend will receive the aforementioned data and ask your game's API endpoint for actual user profile data. To obtain a player's profile escs account system sends to Game API Url the following POST request:

export interface Request {
  code: string;
  secretKey: string;
  applicationId: string;
}

where the code is the access token that your game sent to the escs and secretKey is the generated key from the client dashboard. escs expects a response in the following format:

export interface Response {
  _id: string;
  email?: string;
  username?: string;
}

where email and username are the player's data.

For a better understanding of access token and user's game profile data flow you can use the following diagram:

Last updated