> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 账户身份验证和访问概述

> 在 GDK 和跨平台游戏中，使用 XUserHandle、XBOX 身份验证库 (XAL) 和 XUser API 对 XBOX 玩家进行身份验证并管理身份。

使用此主题对账户进行身份验证和访问，使用 XBOX 身份验证库 (XAL)，以及使用 `XUser` API 内容。

XBOX 客户端通过使用 `XUserHandle` 对象来管理与您的游戏交互的用户身份。每个 `XUserHandle` 实例代表一个已登录到您游戏的用户。

有关如何将用户连接到 XBOX 服务的更多信息，请参阅 [操作方法：登录用户的最佳实践](https://docs.xbox.com/zh-CN/build/core-features/common/user/xuser_howto_best_practice_signing_in.md) 中的代码示例。

## Windows PC 上的 XBOX 应用

对于 Windows PC 开发，您可以使用 XBOX 应用通过开发沙盒中的[测试账户](https://docs.xbox.com/zh-CN/services/xbox-services/develop/test-accounts/live-setup-testaccounts.md)来访问 XBOX 服务。请使用以下步骤从开发沙盒访问测试账户。

1. [从 Microsoft Store](https://www.microsoft.com/store/productId/9MV0B5HZVK9Z) 下载并安装 XBOX 应用。
2. 切换到游戏的开发沙盒。您可以使用 [PC Sandbox Switcher](https://docs.xbox.com/zh-CN/tools/tools-services/live-pc-sandbox-switcher.md) 工具在 Windows PC 上切换开发沙盒。
3. 打开 XBOX 应用。
4. 选择个人资料图标，然后选择 **登录**。
5. 按照说明访问账户。

要退出账户，请打开 XBOX 应用，然后选择个人资料图标 > **退出**。

## XAL 和 XUser

XAL 和 `XUser` 是类似的 API。提供 XAL 是为了支持跨平台游戏。

> [!NOTE]
>
> 如果您的目标是跨平台（移动端和 GDK），请使用 XAL。如果您仅面向 GDK，请改用 `XUserHandle`。

## 另请参阅

[用户身份和 XUser](https://docs.xbox.com/zh-CN/build/core-features/common/user/player-identity-xuser.md)


## Related topics

- [用户登录](https://docs.xbox.com/zh-CN/services/xbox-services/fundamentals/identity/auth/live-authentication-nav.md)
- [身份验证](https://docs.xbox.com/zh-CN/services/xbox-services/fundamentals/identity/auth/index.md)
- [用户身份验证与所有权](https://docs.xbox.com/zh-CN/build/steam-porting-guide/features/user-authentication-and-ownership.md)
- [身份验证和 S2S](https://docs.xbox.com/zh-CN/services/xbox-services/fundamentals/s2s-auth-calls/live-s2s-auth-calls-nav.md)
- [游戏服务的 XBOX services 身份验证](https://docs.xbox.com/zh-CN/services/xbox-services/fundamentals/s2s-auth-calls/service-authentication/live-title-service-authentication.md)
