> ## 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 遊戲的 Sign in with Apple。
</Info>

## 在 PlayFab 中設定 Apple 附加元件

若要在 PlayFab 中設定 Apple 附加元件：

1. 登入 [Game Manager](https://developer.playfab.com)。
2. 從 \[My Studios and Titles] 頁面選取您的遊戲。
3. 在 **Add-ons** 窗格中，選取 **Apple** 平台。
4. 若要安裝 Apple 附加元件，請選取 **Install Apple**。
5. 將 **iOS App Bundle ID** 設定為您在上一節中取得的 App ID。

<Note>
  此時，您需要選擇是否要忽略身分識別權杖的到期日。
</Note>

您的選項如下：

* 忽略到期日：這會提供安全性較低但較佳的使用者體驗。不過，如果 Apple 輪替簽署金鑰，就無法再驗證已過期的身分識別權杖。在此情況下，使用者必須登入以提供新的身分識別權杖。
* 遵守到期日：這會提供更安全的體驗，但代價是可能會導致使用者多次登入。Apple 身分識別權杖目前會在 10 分鐘後到期，之後您的遊戲必須要求使用者再次登入以取得新的權杖。

6. 根據您選擇的使用者體驗，適當設定 **Ignore expiration date for identity tokens**。

<Tip>
  如果您選擇忽略身分識別權杖的到期日，您的遊戲應將從 Apple 取得的身分識別權杖儲存在本機。每次登入時都會重複使用該身分識別權杖。
</Tip>


## Related topics

- [為 PlayFab 設定使用 Battle.net 登入](/zh-TW/services/playfab/identity/player-identity/platform-specific-authentication/battlenet-login.md)
- [兌換 Apple App Store 應用程式內購買](/zh-TW/services/playfab/economy-monetization/economy-v2/marketplace/marketplace-redemption/apple.md)
- [PlayFab Unified SDK 快速入門設定](/zh-TW/services/playfab/sdks/unified-sdk/quickstart-setup.md)
- [Photon 快速入門](/zh-TW/services/playfab/live-service-management/service-gateway/add-ons/photon/quickstart.md)
- [開始使用 Android Studio 和推播通知](/zh-TW/services/playfab/live-service-management/game-configuration/title-communications/push-notifications/getting-started-android-studio-push-notifications.md)
