> For the complete documentation index, see [llms.txt](https://docs.authgear.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.authgear.com/authentication-and-access/social-enterprise-login-providers/social-login-providers/apple.md).

# Connect Apps to Apple

## Prerequisite

To configure "Sign in with Apple" for Authgear, you will need to fulfil the following:

1. Register an Apple Developer Account. Apple Enterprise Account does not support "Sign in with Apple"
2. Register your own domain.
3. Your domain must be able to send and receive emails.
4. Set up [Sender Policy Framework](https://en.wikipedia.org/wiki/Sender_Policy_Framework)(SPF) for your domain.
5. Set up [DomainKeys Identified Mail](https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail)(DKIM) for your domain.
6. Create an "App ID" by adding a new "Identifier" [here](https://developer.apple.com/account/resources/identifiers/list), choose app IDs, enable "Sign in with Apple" enabled.
7. Create a "Services ID" by adding a new "Identifier" [here](https://developer.apple.com/account/resources/identifiers/list), choose service IDs, enable "Sign in with Apple".
8. Click "Configure" the Next to "Sign in with Apple". In "Primary App ID" field, select app ID created above.

   <figure><img src="/files/knuf37t1DtreSFFEGuCA" alt=""><figcaption><p>Select here to see Services IDs</p></figcaption></figure>
9. Fill in and verify the domain created above, add `https://<YOUR_AUTHGEAR_ENDPOINT>/sso/oauth2/callback/apple` to **Return URLs**
10. Create a "Key" following [this guide](https://developer.apple.com/help/account/manage-keys/create-a-private-key) with "Sign in with Apple" enabled. Click "Configure" next to "Sign in with Apple" and select "Primary App ID" with app ID created above. Keep the private key safe, you need to provide this later.

{% hint style="info" %}
Redirect URI has the form of `/sso/oauth2/callback/:oauth_provider_alias`. The `oauth_provider_alias` is the OAuth Provider Alias configured for this provider in Authgear Portal.
{% endhint %}

## Configure Sign in with Apple in Authgear Portal

1. In the portal, go to **Authentication > Social / Enterprise Login**.
2. Enable **Sign in with Apple**.
3. In **Client ID**, add the identifier of the **Services ID** you created in Apple. Not the ID of the App ID or the Client ID of your Authgear Application.
4. In **Apple Developer Portal**, view key information of the "Key" created above.
5. Jot down the **Key ID** and download the key text file (`.p8` file).
6. Copy the content in the key text file to **Client Secret** text area in **Authgear Portal.**.
7. Fill in **Key ID** field using the **Key ID** obtained from step 5.
8. In **Apple Developer Portal**, click username on the top right corner, click **View Membership**.
9. Find the **Team ID** from **Membership Information**, fill in **Team ID** field in Authgear portal.
10. **Save** the settings.

🎉Done! You have just added Sign in with Apple to your apps!


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.authgear.com/authentication-and-access/social-enterprise-login-providers/social-login-providers/apple.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
