---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://yandex.com/dev/games/doc/en/sdk/construct-3/authorization-and-data.md
  - https://yandex.com/dev/games/doc/hi/sdk/construct-3/authorization-and-data.md
  - https://yandex.com/dev/games/doc/ko/sdk/construct-3/authorization-and-data.md
  - https://yandex.com/dev/games/doc/ru/sdk/construct-3/authorization-and-data.md
  - https://yandex.com/dev/games/doc/tr/sdk/construct-3/authorization-and-data.md
  - https://yandex.com/dev/games/doc/vi/sdk/construct-3/authorization-and-data.md
  - https://yandex.com/dev/games/doc/zh/sdk/construct-3/authorization-and-data.md
  - href: zh/sdk/construct-3/authorization-and-data.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/games/doc/zh/llms.txt

# 授权和玩家数据

<!-- source: zh/_includes/script-common.md -->
<!-- source: zh/_includes/script/index-js.md -->

<!-- endsource: zh/_includes/script/index-js.md -->

<!-- source: zh/_includes/script/requirements-js.md -->

<!-- endsource: zh/_includes/script/requirements-js.md -->

<!-- source: zh/_includes/script/image-modal-js.md -->

<!-- endsource: zh/_includes/script/image-modal-js.md -->
<!-- endsource: zh/_includes/script-common.md -->

您可以将游戏状态数据（已完成的关卡、经验、应用内购买等）保存在 Yandex 服务器上或将其发送到您自己的服务器。您还可以使用 Yandex 用户档案中的某些数据（如用户名）来个性化游戏。



## 玩家信息 {#player-info}

要开始使用玩家数据，请将 **Fetch player info** 操作与触发条件 **Player info is successfully fetched** 和 **Failure to fetch player info** 结合使用。

要获取玩家数据，请使用：

- 条件 **Player is authorized**：检查玩家是否在 Yandex 上获得授权。
- 条件 **Player personal info access granted**：检查是否已获取玩家的个人数据。
- 表达式 **Player signature**：`string`，包含来自 Yandex 个人资料的用户数据和签名。由两个以 `Base64` 格式编码的字符串组成。
- 表达式 **Player avatar**：`string`，玩家头像链接。
- 表达式 **Player name**：`string`，玩家名称。
- 表达式 **Player paying status**：`string`，用户在平台上的支付活动状态。
- 表达式 **Player unique id**：`string`，玩家的唯一标识符。

![](../../_images/construct-3/authorization-and-data/fetch-player-info.webp)



## 游戏内数据 {#actions}

要处理用户的游戏内数据，请使用以下操作：

 - **Get player data** —— 请求用户的游戏内数据并将其写入 JSON 对象。
 - **Set player data** —— 从 JSON 对象将用户的游戏内数据发送到 Yandex Games。
 - **Get player stats** —— 请求用户的数值数据并将其写入 JSON 对象。
 - **Set player stats** —— 从 JSON 对象将用户的数值数据发送到 Yandex Games。
 - **Increment player stats** —— 将用户的数值数据增加指定值。

![](../../_images/construct-3/authorization-and-data/player-data.webp)

{% note warning %}

所有这些操作都是异步的，其执行需要一些时间。请记得使用 **Wait for previous actions** 操作以避免错误。

{% endnote %}


---


<!-- source: zh/_includes/button-git.md -->
<a href="https://github.com/yandex-games-plugins/construct3">
  <span class="button">存储库</span>
</a>
<!-- endsource: zh/_includes/button-git.md -->
