App Store Requirement: Apple requires that if you implement any third-party authentication options (like Google Sign-In) in your iOS app, you must also implement Apple Sign-In to pass the App Store review process. This is a mandatory requirement from Apple, not optional.
Prerequisites
Before setting up Apple Sign-In, make sure you have:- Set up your Supabase project with basic configuration
- An Apple Developer account (requires paid enrollment in the Apple Developer Program)
- Access to the Apple Developer Portal
Setting Up Apple Sign-In
1
Create an App ID in the Apple Developer Portal
- Go to the Apple Developer Portal
- Under
Certificates, IDs & Profiles
, click onIdentifiers
. - Click the
+
button to create a new identifier - Select
App IDs
and clickContinue
- Choose
App
as the type and clickContinue
- Fill in a description (e.g., “My App”)
- Enter your
Bundle Identifier
that matches yourapp.json
(e.g.,com.buildwithai.travelapp
) - Scroll down to
Capabilities
and enableSign In with Apple
- Click
Continue
thenRegister
on the top right
2
Create a Service ID
- Go to the Apple Developer Portal
- Under
Certificates, IDs & Profiles
, click onIdentifiers
. - Click the
+
button to create a new identifier - Select
Service IDs
and clickContinue
- Fill in a description (e.g., “My App - Apple Sign In”)
- Enter a unique identifier, which could be your app ID with
.signin
appended (e.g.com.buildwithai.travelapp.signin
) - Click
Continue
thenRegister
on the top right
- Click on your newly created Service ID from the list
- Check
Sign In with Apple
and clickConfigure
- Add your Supabase domain as a Website URL (your Supabase project URL in
.env
) - Add your return URL (your Supabase project URL in
.env
+/auth/v1/callback
) - Click
Save
, thenContinue
, andSave
again
3
Create a Private Key
- Go to the Apple Developer Portal
- Under
Certificates, IDs & Profiles
, click onKeys
in the sidebar - Click the
+
button to create a new key - Enter a name for your key (e.g., “My App Sign In Key”)
- Check
Sign In with Apple
and clickConfigure
- Select your primary App ID (e.g.,
com.buildwithai.travelapp
) and clickSave
- Click
Continue
thenRegister
- Download your private key file (a file with
.p8
at the end) - this can only be downloaded once - Note your
Key ID
for later use
Generate a client_secret
The secret key you downloaded is used to create the client_secret string you’ll need to authenticate your users. According to the Apple Docs it needs to be a JWT token encrypted using the Elliptic Curve Digital Signature Algorithm (ECDSA) with the P-256 curve and the SHA-256 hash algorithm. This integration includes scripts to generate the required client secret JWT for Apple Sign-In - choose either the interactive or manual method below.Option 1: Interactive Script (Recommended)
We’ve included an interactive script that guides you through the process step-by-step:-
Prepare your credentials:
- Have your Apple Developer credentials ready (Team ID, Service ID, Key ID)
- Copy your downloaded
.p8
private key file to the project root directory
-
Run the interactive script:
-
Follow the prompts:
- Enter your Team ID when asked
- Enter your Service ID (e.g.,
com.buildwithai.travelapp.signin
) - Enter your Key ID
- The script will automatically find your
.p8
file if it’s in the project root
-
Copy the result:
- The script will output a long JWT token
- Copy the entire token (it starts with
eyJ...
)
-
Add to Supabase:
- Go to your Supabase Dashboard
- Navigate to Authentication → Sign In / Providers
- Find “Apple” and click to configure
- Enable “Sign in with Apple”
- Paste the JWT as “Secret Key (for OAuth)”
- Set “Client IDs” to your Service ID
- Click Save
Alternative: Manual Script
If the interactive script doesn’t work for your setup or you prefer a manual approach, you can use the alternative manual script:-
First, open and update
integrations/apple-auth/gen-apple-secret.js
with your Team ID, Service ID, Key ID, and private key file path -
Then run the script:
Enabling Apple Sign-In in Your App
Now that you’ve set up Apple Sign-In with Supabase, you need to enable the feature in your app codebase:1
Implementation
Follow the implementation instructions in the
integrations/apple-auth/README.md
file included in your boilerplate codebase. This file contains all necessary steps for setting up Apple Sign-In in your application.Testing Your Configuration
To test your Apple Sign-In configuration:- Rebuild development build
- Navigate to the sign-in screen
- Tap the “Sign in with Apple” button
- Complete the Apple authentication flow
- Verify that you are successfully signed in to your app