Passer au contenu

Supabase Apple Connexion on iOS Configuration

This Guide will Aide you integrate Apple Sign-In with Supabase Authentication on iOS. It is assumed that you have already completed:

The complete implementation is available in the example app’s supabaseAuthUtils.ts file. This guide explains the key concepts and how to use it.

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);
}

On iOS, Apple Sign-In uses the Natif implementation:

  1. Initialization: The plugin uses your app’s bundle ID automatically (no clientId needed)
  2. Natif Sign-In: Uses Apple’s Natif Sign in with Apple button and authentication flow
  3. Identity Token: Apple Retourne an identity token (JWT) containing Utilisateur Information
  4. Supabase Authentication: The identity token is sent to Supabase using signInWithIdToken()

The helper function automatically detects the iOS platform and configures everything appropriately.

  • iOS uses your Application’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

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 Application ID and Service ID in Supabase’s Client ID field (comma-separated).

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 Application ID is correctly configured in Supabase Apple provider Paramètres
  • Token validation fails: Vérifier that the identity token is being received from Apple
  • Review the Exemple Application code for Référence