Supabase Apple Login on iOS Setup
Prerequisites
Section titled āPrerequisitesāThis guide will help you integrate Apple Sign-In with Supabase Authentication on iOS. It is assumed that you have already completed:
Implementation
Section titled āImplementationāThe complete implementation is available in the example appās supabaseAuthUtils.ts file. This guide explains the key concepts and how to use it.
Using the Authentication Helper
Section titled āUsing the Authentication HelperāThe authenticateWithAppleSupabase function handles the entire authentication flow:
import { authenticateWithAppleSupabase } from './supabaseAuthUtils';
const result = await authenticateWithAppleSupabase();if (result.success) { console.log('Signed in:', result.user); // Navigate to your authenticated area} else { console.error('Error:', result.error);}How It Works
Section titled āHow It WorksāOn iOS, Apple Sign-In uses the native implementation:
- Initialization: The plugin uses your appās bundle ID automatically (no
clientIdneeded) - Native Sign-In: Uses Appleās native Sign in with Apple button and authentication flow
- Identity Token: Apple returns an identity token (JWT) containing user information
- Supabase Authentication: The identity token is sent to Supabase using
signInWithIdToken()
The helper function automatically detects the iOS platform and configures everything appropriately.
Important Notes
Section titled āImportant NotesāBundle ID Configuration
Section titled āBundle ID Configurationā- iOS uses your appās bundle ID automatically for Apple Sign-In
- Make sure your bundle ID matches whatās configured in Apple Developer Portal
- The bundle ID should have āSign in with Appleā capability enabled
Supabase Client ID
Section titled āSupabase Client IDāIn Supabase, configure your Apple provider with:
- Client ID: Your iOS App ID (bundle ID) - e.g.,
app.capgo.plugin.SocialLogin
If youāre also using Android/Web, youāll need to provide both the App ID and Service ID in Supabaseās Client ID field (comma-separated).
Troubleshooting
Section titled āTroubleshootingāIf authentication fails:
- Bundle ID mismatch: Verify your bundle ID matches in both Xcode and Apple Developer Portal
- Capability not enabled: Ensure āSign in with Appleā capability is enabled in Xcode
- Supabase configuration: Verify your App ID is correctly configured in Supabase Apple provider settings
- Token validation fails: Check that the identity token is being received from Apple
- Review the example app code for reference