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

# Set Up Apple SSO

This article explains how to set up Apple SSO Login for your web store.

## In the Apple dashboard

Follow the steps below to configure the login in Apple's dashboard:

### Create an App ID

1. Go to the [Apple Developer Portal](https://developer.apple.com/account) and sign in with your Apple Developer account.

2. Go into your [account](https://developer.apple.com/account).

3. In the **Certificates, Ids & Profiles** section, select **[Identifiers](https://developer.apple.com/account/resources/identifiers/list)**.

4. Click the **+** button to create a new **App ID**.

5. Edit your existing app by selecting your app and and clicking **Continue**.

6. Fill in the required fields:

   * Description
   * Bundle ID
   * Under **Capabilities** select **Sign in with Apple**. Click **Continue**, and then click **Register** to create the App ID. After registering you should be redirected back to the identifiers page.

### Create a Service ID for your web application

1. In the **Certificates, Ids & Profiles** section, select **[Identifiers](https://developer.apple.com/account/resources/identifiers/list)**.

2. Click the **+** button and select ****Services IDs****, and then click **Continue**.

3. Fill in the required fields:

   * Description
   * Identifier - reversed domain click **Continue** and then click **Register**. After registering you should be redirected back to the identifiers page.

4. Click on the newly created Service ID, and a details page will open. Select the checkbox next to the **Sign in with Apple** capability, and then click **Configure**.

5. Add your domain and redirect URLs as follows:

   * Add your domain in the **Domains and Subdomains** section. You'll need to verify your domain by following the instructions provided by Apple.
     * Example for store domain: [https://shop.sweetsugarbakery.com](https://shop.sweetsugarbakery.com)

   * Add your redirect URL(s) in the **Return URLs** section. This is where the user will be redirected after a successful authentication. After a successful configuration, confirm the list you’d like to add to this Services ID and click **Done**. To complete the process, click **Continue**, and then click **Save**.
     * Example for return URL: [https://shop.sweetsugarbakery.com/login?apple=true](https://shop.sweetsugarbakery.com/login?apple=true)

### Create a private key for client authentication

1. In the **Certificates, Ids & Profiles** section, click **[Keys](https://developer.apple.com/account/resources/authkeys/list)**.
2. Click the **+** button to create a new key.
3. Fill in the key name, check **Sign in with Apple** and click **Configure**.
4. Select the primary App ID you created earlier, then click **Save** and **Continue**.
5. Review the key details and click **Register**.
6. Download the private key (.p8 file) and securely store it. You'll need this to authenticate your server.

### Example

This example demonstrates how to open the player token generated when a player clicks the **Sign in with Apple** button in the web store login page:

<CodeGroup>
  ```python python theme={"system"}
  import jwt
  from datetime import datetime, timedelta
  client_id = 'CLIENT_SERVICE_ID'
  team_id = 'APPLE_DEVELOPER_TEAM_ID'
  private_key = '''-----BEGIN PRIVATE KEY-----
  YOUR PRIVATE KEY
  -----END PRIVATE KEY-----''' # Private key in PEM format
  header = {
   'alg': 'ES256',
   'kid': YOUR_PRIVATE_KEY_ID # Key ID for your private key
  }
  payload = {
   'iss': team_id,
   'iat': datetime.utcnow(),
   'exp': datetime.utcnow() + timedelta(days=180),# 180 days expiration time
   'aud': 'https://appleid.apple.com',
   'sub': client_id
  }
  client_secret = jwt.encode(payload, private_key, algorithm='ES256', headers=header)
  print(client_secret)
  ```
</CodeGroup>

### Supported methods for Apple sign in

Appcharge supports both `code` and `id_token` methods for Apple Sign-In.

* **`id_token`:** A JWT (JSON Web Token) issued by Apple containing information about the authenticated user.
* **`code`:** A short-lived authorization code used for server-to-server communication to fetch access tokens.

Both methods will be sent to your [Authenticate Player Callback](/../../api-reference/webstore/player-authentication/authenticate-player-callback).

By default, Appcharge uses the `code` method. To adjust this configuration, please contact the Appcharge support team.

For further details on Apple’s implementation, refer to their documentation.

## In the Publisher Dashboard

Follow the steps below to configure the login in the Publisher Dashboard:

1. Go to **Settings -> Authentication**.
2. Toggle on **Apple App**, and enter your Apple ID in the **Apple App ID** field.
3. The button for logging in with Apple will appear in the web store login page.
4. Once a player selects this method, Apple generates a token. Apppcharge sends this token along with other login information to your [Authenticate Player Callback](/../../api-reference/webstore/player-authentication/authenticate-player-callback) for verification.
5. Once verified, the player is logged into the web store.

<img src="https://mintcdn.com/appcharge/Gmzl86FePs5bNqWW/images/docs/0b1159c3e5dfb017a959537a8e169a38e34bd0b68b92f55ca38a56b45a0e00eb-How_to_configure_Apple_SSO_login.png?fit=max&auto=format&n=Gmzl86FePs5bNqWW&q=85&s=8f699fcda4ed8be0a3f19c9fcc448492" alt="" width="3952" height="2774" data-path="images/docs/0b1159c3e5dfb017a959537a8e169a38e34bd0b68b92f55ca38a56b45a0e00eb-How_to_configure_Apple_SSO_login.png" />
