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

# Add Apple authentication to your app

> Add Sign in with Apple to your app using managed Apple OAuth or your own Apple Developer credentials.

> [!NOTE]
>
> This page documents **Apple authentication for your app's users**. It is available only for apps using the [built-in backend](https://docs.lovable.dev/features/cloud). For an overview of all sign-in methods, see [Users and authentication](https://docs.lovable.dev/features/authentication).

Let users sign in to your app with their Apple account instead of creating a password. Apple sign-in fits apps with an audience on Apple devices, and apps that already offer [Google sign-in](https://docs.lovable.dev/features/google-auth.md) and want parity.

Apple lets users hide their real email address. Your app then receives a private relay address from Apple, which forwards mail to the user's inbox.

## Choose a setup option

Users sign in the same way with both options. The options differ in who manages the credentials and what you can control.

| Option | Choose it when |
| - | - |
| **Managed by Lovable** (the default) | You want sign-in working without an Apple Developer account. Lovable manages the OAuth configuration and the security updates. |
| **Your own credentials** | You want the sign-in flow tied to your own Apple Developer account and identifiers, or you need to own the credentials for security or compliance reasons. Only this option has a setting that lets users sign in without sharing any email address, not even a relay address. You manage the credentials and their rotation yourself. |

> [tab] Managed by Lovable (default)
>
> **1. Ask Lovable to add Apple sign-in**
>
> In the project chat, ask:
>
> ```text wrap theme={null}
> Add an Apple sign-in button to my app.
> ```
>
> Lovable enables the provider in **More → Users → Settings → Apple** and adds the sign-in button to your app's login page. If you enable it yourself in the same settings, Lovable sends a message to the project chat on your behalf and adds the button. That message is treated as standard build usage and consumes credits.
>
> **2. Test the flow**
>
> Verify that:
>
> * a **Sign in with Apple** button appears on your login page
> * users are redirected to Apple to confirm
> * users return to the app in a signed-in state
> * new users appear in **More → Users**
>
> With **Managed by Lovable**, users must share an email address with your app to complete sign-in. Users who pick Apple's **Hide My Email** option still provide one: Apple shares a private relay address with your app instead of the real one.

> [tab] Your own credentials
>
> You need a paid Apple Developer Program membership with admin access to the account.
>
> **1. Configure Sign in with Apple in your Apple Developer account**
>
> In the [Apple Developer portal](https://developer.apple.com/account), you need:
>
> * an **App ID** with the **Sign in with Apple** capability enabled
> * a **Services ID** to act as the client identifier for the web flow
> * a **key** with Sign in with Apple enabled, downloaded as a `.p8` file (note its **Key ID** and your **Team ID**)
>
> See Apple's [Sign in with Apple documentation](https://developer.apple.com/sign-in-with-apple/get-started/) for the portal walkthrough.
>
> **2. Enter your credentials in Lovable**
>
> In **More → Users → Settings → Apple**, choose **Your own credentials** and fill in:
>
> * **Client ID**: your Services ID (or Bundle ID) in reverse domain name notation, for example `com.example.app`.
> * **Client secret (JWT)**: a JSON Web Token generated from your `.p8` key. Use the built-in **Generate secret** helper: upload the `.p8` file and enter your Key ID, Services ID, and Team ID, and it builds the JWT for you.
>
> **3. Add the return URLs to your Apple configuration**
>
> Copy the URLs from the **Redirect URL(s)** field in Lovable into your Services ID configuration in the Apple Developer portal, where Apple calls them **Return URLs**. Sign-in fails with a redirect error until these match.
>
> **4. Test the flow**
>
> Sign in with an Apple account, including once with **Hide My Email** selected, and confirm the user appears in **More → Users**.
>
> > [!WARNING]
> >
> > Apple requires you to generate a new client secret every 6 months using your signing key. Generate a new JWT before the current one expires, or users will not be able to sign in.
>
> ### Allow users without an email
>
> Apple lets users hide their email address when signing in. With your own credentials, the **Allow users without an email** toggle controls whether such users can sign in to your app. If your app's features depend on reaching users by email, consider leaving it disabled.

## Managing Apple authentication

You can switch between **Managed by Lovable** and **Your own credentials** at any time from **More → Users → Settings → Apple**. Existing accounts are kept, but Apple identifies users per developer team: users who signed up under the previous mode may not be recognized when they next sign in with Apple, and Hide My Email relay addresses change with the team. Plan the switch before your app has many Apple users.

To remove the sign-in option, ask Lovable in the project chat:

```text wrap theme={null}
Remove the Apple sign-in button from my app.
```

You can also disable the provider in the auth settings. Lovable then sends a message to the project chat on your behalf and removes the button. That message is treated as standard build usage and consumes credits. Users who signed up with Apple keep their accounts but need another enabled sign-in method to get back in.

## Troubleshooting

> [accordion] Apple sign-in stopped working after months of working fine
>
> Your client secret has probably expired. Apple limits each JWT to 6 months. Generate a new secret from your `.p8` key with **Generate secret** and save it in the Apple auth settings.

> [accordion] Users see a redirect or invalid client error
>
> The return URLs in your Apple Services ID configuration don't match the redirect URLs Lovable shows. Copy every return URL from Lovable into the Apple Developer portal exactly, then retry. If sign-in fails only on your published app or custom domain, also check your project's [redirect URLs](https://docs.lovable.dev/features/authentication#site-url-and-redirect-urls).

> [accordion] Support can't reach a user who hid their email
>
> Apple forwards mail sent to the relay address only while the user keeps forwarding enabled. Treat the relay address like any other email in your app, and offer an in-app way for users to update their contact details.

## FAQ

> [accordion] Do I need an Apple Developer account?
>
> Only if you use your own credentials. In Managed by Lovable mode, Lovable provides the OAuth configuration and no Apple Developer account is needed.

> [accordion] What happens when a user hides their email?
>
> Apple shares a private relay address with your app instead of the real one, so the user still has an email your app can use. With your own credentials, the **Allow users without an email** toggle additionally controls whether users can sign in without providing any address.

> [accordion] Why did Apple sign-in suddenly stop working?
>
> If you use your own credentials, the most common cause is an expired client secret: Apple limits each JWT to 6 months. Generate a new secret from your `.p8` key and save it in the Apple auth settings.

> [accordion] Does Apple sign-in replace email and password sign-in?
>
> No. It is an additional sign-in method, and you can offer it alongside [email](https://docs.lovable.dev/features/email-auth.md), [Google](https://docs.lovable.dev/features/google-auth.md), and other methods.

> [accordion] Can I switch between managed and my own credentials later?
>
> Yes, anytime from **More → Users → Settings → Apple**. Existing accounts are kept, but Apple identifies users per developer team, so users who signed up under the previous mode may not be recognized after the switch. Plan the switch before your app has many Apple users.

> [accordion] Can a native iOS app built outside Lovable use Sign in with Apple with my project's backend?
>
> Not with **Managed by Lovable**. In that mode, Lovable signs people in with its own Apple identifiers, so your project's backend does not accept a token that Apple issues to your iOS app. With your own credentials, **Client ID** takes one identifier: your Services ID for sign-in in the browser, or the app's Bundle ID for native sign-in in the iOS app.
>
> To sign people in from the iOS app, have it open Sign in with Apple in the browser. Add the app's custom scheme, such as `myapp://callback`, to **Redirect URLs** in the auth settings. See [Site URL and redirect URLs](https://docs.lovable.dev/features/authentication#site-url-and-redirect-urls).

> [accordion] Do users need an iPhone to use Sign in with Apple?
>
> No. Sign in with Apple works in any browser. Users sign in with their Apple Account credentials, and users on Apple devices get the smoothest flow.
