Prerequisites
- A published Replit app (you need a deployment URL like
your-app.replit.app) - An Apple Developer account (requires enrollment in the Apple Developer Program)
Step 1: Publish your app
Before configuring custom OAuth credentials, you need a published deployment URL. You’ll need the URL when setting up your custom Apple credentials.- Publish your app from the Replit workspace
- Note your published URL (e.g.,
https://your-app.replit.app)
Step 2: Create an Apple App ID
- Navigate to the Apple Developer portal
- Go to Certificates, IDs & Profiles then Identifiers
- Select App IDs from the dropdown
- Select the + icon to register a new identifier
- Select App IDs, then Continue
- Choose App, then Continue
- Fill in:
- Description: Name for your App ID
- Bundle ID: Your unique identifier
- Enable Sign In with Apple under Capabilities
- Select Continue, then Register
- Save your App ID Prefix (shown at top) - this is your Team ID
Step 3: Create an Apple Services ID
- On the Identifiers page, select Services IDs from the dropdown
- Select + to register a new identifier
- Select Services IDs, then Continue
- Fill in:
- Description: Name for your Services ID
- Identifier: Your unique identifier (save this - it’s your Services ID)
- Select Continue, then Register
Configure the Services ID
- Select your newly created Services ID
- Enable Sign In with Apple
- Select Configure
- Set:
- Primary App ID: Select your App ID from Step 2
- Domains and Subdomains: Add your published domain without the protocol:
- Return URLs: The return URL is your published domain followed by
/__clerk/v1/oauth_callback:
- Select Next, then Done, then Continue, then Save
Step 4: Create an Apple Private Key
- In the Apple Developer portal sidebar, select Keys
- Select + to register a new key
- Enter a Key Name
- Enable Sign In with Apple
- Select Configure, then select your App ID from Step 2
- Select Save, then Continue, then Register
- Save the Key ID
- Download the private key file (.p8)
Step 5: Configure Apple Private Email Relay
Apple’s Hide My Email feature lets users sign in without revealing their real email. To send emails to these users, register your email source.- In the Apple Developer portal sidebar, select Services
- Under Sign in with Apple for Email Communication, select Configure
- Select + to add an Email Source
- Enter the Email Source value from the Replit Auth configuration form
- Select Next, then Register, then Done
- Wait for DNS verification (green check icon)
In some regions (China, India), Apple IDs may be tied to phone numbers instead of email. If your app requires email for all users, Sign in with Apple may fail for users in these regions.
Step 6: Enter credentials in Replit
- In your Repl, navigate to the Auth pane
- Select the Configure tab
- Select Production environment
- Select the Edit button next to Apple
- Toggle on Use custom credentials
- Enter all the values you collected:
- Team ID (App ID Prefix from Step 2)
- Services ID (Identifier from Step 3)
- Key ID (from Step 4)
- Private Key: Open the .p8 file in a text editor, copy the entire contents including the
-----BEGIN PRIVATE KEY-----and-----END PRIVATE KEY-----lines
- Select Save changes
- Toggle Apple to Enabled
Step 7: Test your integration
- Open your published app’s login page
- Select Sign in with Apple
- Complete the Apple sign-in flow
- Verify successful authentication
Troubleshooting
Invalid client
- Verify all credentials are entered correctly
- Ensure the Private Key includes the BEGIN and END lines
- Check that your Services ID is properly configured
Invalid redirect URI
- Verify the Return URL in the Apple Services ID configuration is exactly
https://your-app.replit.app/__clerk/v1/oauth_callback - Check the domain in Domains and Subdomains matches your published domain (without
https://)
Email relay not working
- Verify the Email Source shows a green check in the Apple Developer portal
- Wait for DNS propagation if recently added
Not working on custom domain
- Add your custom domain to Domains and Subdomains in the Services ID configuration (without
https://) - Add
https://your-custom-domain.com/__clerk/v1/oauth_callbackas an additional Return URL - Republish your app