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

# 为 PlayFab 设置 Sign In with Apple

> 为 PlayFab 设置 Sign in with Apple，包括应用程序标识符设置、Apple 证书以及用于玩家身份验证的 OpenID 配置。

本指南涵盖了将 PlayFab 应用程序设置为利用 Sign in with Apple 所需的一系列步骤。

## 设置你的应用程序标识符

在你的应用程序中使用 Sign in with Apple 之前，你需要处理 Apple 开发者门户的[Certificates, Identifiers & Profiles](https://developer.apple.com/account/resources/certificates/list) 部分中的一些设置步骤。

1. 登录你的 [Apple Developer Program](https://developer.apple.com/programs/) 账户。
2. 选择 **Certificates, Identifiers & Profiles**。
3. 在 **Identifiers** 窗格中，选择你的应用程序标识符，或选择 **(+)** 创建新标识符。

<Note>
  如果你正在创建新标识符，请选择 **App IDs** 作为新标识符类型。
</Note>

4. 滚动浏览功能列表并选择 **Sign in with Apple**。
5. 在 **Sign in with Apple** 设置弹出窗口上按 **Continue** 或 **Save**。
6. 确保完全创建并更新你的应用程序标识符。

将标识符保存在你可以轻松访问的位置。你将在下一组步骤中使用它。

<Info>
  PlayFab 仅支持来自 iOS 或 MacOS title 的 Sign in with Apple。
</Info>

## 在 PlayFab 中设置 Apple 附加组件

要在 PlayFab 中设置 Apple 附加组件：

1. 登录 [Game Manager](https://developer.playfab.com)。
2. 从 My Studios and Titles 页面选择你的 title。
3. 在 **Add-ons** 窗格中，选择 **Apple** 平台。
4. 要安装 Apple 附加组件，请选择 **Install Apple**。
5. 将 **iOS App Bundle ID** 设置为你在上一节中检索的 App ID。

<Note>
  此时，你需要选择是否忽略身份令牌的过期日期。
</Note>

你的选项是：

* 忽略过期日期：这提供了不太安全但更好的用户体验。但是，如果 Apple 轮换签名密钥，则过期的身份令牌将无法再被验证。在这种情况下，用户必须登录才能提供新的身份令牌。
* 遵守过期日期：这提供了更安全的体验，但代价是可能导致用户多次登录。Apple 身份令牌当前在 10 分钟后过期，之后你的 title 必须要求用户再次登录以获取新令牌。

6. 根据你选择的用户体验，适当地设置 **Ignore expiration date for identity tokens**。

<Tip>
  如果你选择忽略身份令牌的过期日期，你的 title 应在本地存储从 Apple 获取的身份令牌。每次登录时都会重复使用该身份令牌。
</Tip>


## Related topics

- [为 PlayFab 设置 Sign In with Battle.net](/zh-CN/services/playfab/identity/player-identity/platform-specific-authentication/battlenet-login.md)
- [PlayFab 统一 SDK 快速入门设置](/zh-CN/services/playfab/sdks/unified-sdk/quickstart-setup.md)
- [兑换 Apple App Store 应用内购](/zh-CN/services/playfab/economy-monetization/economy-v2/marketplace/marketplace-redemption/apple.md)
- [Photon 快速入门](/zh-CN/services/playfab/live-service-management/service-gateway/add-ons/photon/quickstart.md)
- [使用 Google 和 HTML5 设置 PlayFab 身份验证](/zh-CN/services/playfab/identity/player-identity/platform-specific-authentication/google-html5.md)
