Apple
This guide explains how to set up Apple as an authentication provider with Stack Auth. Sign in with Apple allows users to sign in to your application using their Apple ID.
You will need to create an Apple Developer account, and generate an Apple Services ID, Apple Private Key, Apple Team ID, and Apple Key ID.
Integration Steps
Create an Apple App ID and Services ID
- Log in to the Apple Developer Portal.
- Navigate to Certificates, IDs & Profiles.
- In the sidebar, select Identifiers and click the "+" button to register a new identifier.
- Select App IDs and click Continue.
- Select App as the type and click Continue.
- Give your app a description and a Bundle ID (e.g., com.yourdomain.app).
- Scroll down and enable Sign in with Apple, then click Continue, then Register.
- In the top-right of the Identifiers page, switch to Services IDs.
- Click the "+" button to create a new Service ID and click Continue.
- Give it a description and an identifier (note: this cannot be the same as your App ID's bundle ID).
- Click Continue, then Register.
- From the list, select your new Service ID.
- Enable Sign in with Apple by checking the box.
- Click Configure next to Sign in with Apple.
- Register your domains (add api.stack-auth.com).
- Add the return URL:
https://api.stack-auth.com/api/v1/auth/oauth/callback/apple - Click Done, then Continue, and then Save.
Create a Private Key
- In the sidebar, select Keys and click the "+" button.
- Give your key a name and usage description.
- Scroll down to enable Sign in with Apple and click Configure.
- Select your Primary App ID that you created earlier and click Save.
- Click Continue, then Register.
- On the next page, download your key file (.p8). This is critical as you won't be able to download it again.
- Note your Key ID displayed on this page.
- Click Done.
- Find your Account ID at the very top-right of the Apple Developer Portal page.
Generate Your Client Secret
Use the tool below to generate your Apple Client Secret. You'll need:
- Team ID: Your Apple Developer account ID found at the top-right of the portal
- Service ID: The identifier of your Service ID (found in Identifiers > Service IDs)
- Key ID: The ID of the private key you just created
- Private Key File: Upload the .p8 private key file you downloaded
Copy the generated secret immediately - you'll need it for the next step.
Enable Apple OAuth in Stack Auth
- On the Stack Auth dashboard, select Auth Methods in the left sidebar.
- Click Add SSO Providers and select Apple as the provider.
- Set the Client ID (your Service ID identifier), Client Secret (the generated secret from Supabase), and Team ID (your Apple Developer Team ID).
Native App Configuration (iOS/macOS)
Native iOS and macOS apps using the Stack Auth Swift SDK require Bundle ID configuration in addition to the web OAuth setup above. Native apps use Apple's native Sign in with Apple flow (ASAuthorizationController) instead of web-based OAuth.
Bundle IDs are only required for native iOS/macOS apps. Web applications only need the Service ID configuration described above.
Add Your Bundle IDs
- On the Stack Auth dashboard, navigate to Auth Methods and select your Apple provider.
- In the Apple configuration modal, add your app's Bundle ID (e.g.,
com.yourdomain.app). This is the same Bundle ID from your App ID in Apple Developer Portal (Step 1 above). - If you have multiple apps (e.g., separate iOS and macOS apps), add all their Bundle IDs.
- Click Save.
Your native app can now use signInWithOAuth(provider: "apple") from the Swift SDK.
Need More Help?
- Check the Sign in with Apple Documentation
- Join our Discord