Skip to main content

Player authorization and data

You can save game state data (completed levels, experience, in-game purchases, etc.) on the Yandex server or send it to your server. You can also personalize the game using some data from the user's profile on Yandex, such as name.

Player information

To start working with player data, use the Using player info condition. This special condition requests permission from the player and retrieves player data from Yandex.Games for further work.

With this condition, you can access the user's authorization check, get their name, and so on. Keep in mind that all logic using this information should be inside

Using player info.

caution

Make sure this condition is not called multiple times in a row. It is recommended to use it inside functions or a trigger like "On layout start".

Inside the special condition Using player info, you have access to:

  • The Player authorized condition: checks if the player is authorized on Yandex.
  • The Player personal info access granted condition: checks if the player's personal data has been acquired.
  • The Player signature expression: A string containing user data from the Yandex profile and a signature. It consists of two strings encoded in Base64 format.
  • The Player avatar expression: A string, a link to the player's avatar.
  • The Player name expression: A string, the player's name.
  • The Player ID expression: A string, the player's unique identifier.
Player authorization example

In-game data

To work with in-game user data, use the actions:

  • Get player data - requests in-game user data and writes it to a JSON object.
  • Set player data - sends in-game user data to Yandex.Games from a JSON object.
  • Get player stats - requests numerical user data and writes it to a JSON object.
  • Set player stats - sends numerical user data to Yandex.Games from a JSON object.
  • Increment player stats - increases numerical user data by the specified value.

It is worth noting that all these actions are asynchronous, which means that their triggering takes some time. Don't forget to use the Wait for previous actions action to avoid errors.

Example of saving and loading player data