Passer au contenu

Supabase Apple Connexion - General Configuration

This Guide will Aide you integrate Apple Sign-In with Supabase Authentication. Apple Sign-In provides a secure, privacy-focused authentication method that works across iOS, Android, and Web platforms.

Before starting, ensure you have:

  1. Created a Supabase project

  2. Read the Apple Connexion General Configuration Guide to Configuration Apple OAuth credentials

  3. Followed the respective platform-specific guides to Configuration Apple OAuth credentials for your target platform:

    Before starting the Supabase Tutoriel, you need to generate the client IDs for the platforms you plan to use.

    For iOS, the client ID is the same as your Application ID. For Android and Web, the client ID is the same as your service ID. You will use them in step 7 of this Guide.

  1. Go to your Supabase Tableau de bord

  2. Click on your project

    Supabase Project Selector
  3. Do go to the Authentication menu

    Supabase Authentication Menu
  4. Click on the Providers tab

    Supabase Providers Tab
  5. Find the Apple provider

    Supabase Apple Provider
  6. Enable the Apple provider

    Supabase Apple Provider Enable
  7. Fill in the client ID Configuration:

    If you are using Apple Connexion for iOS, the client ID is the same as your Application ID. If you are using Apple Connexion for Android or Web, the client ID is the same as your service ID. If you are using both, you need to provide both the Application ID and the service ID.

    Supabase Apple Provider Client ID
  8. Click on the Save button

    Supabase Apple Provider Save

    You DO NOT HAVE TO setup Secret key (for OAuth). We will do a custom backend implementation to handle the Apple login.

Voilà, you have now enabled Apple Sign-In with Supabase Authentication 🎉

The complete implementation includes a helper function authenticateWithAppleSupabase() that handles the entire Apple Sign-In flow with Supabase. This function:

  • Initializes Apple Sign-In with platform-specific Configuration
  • Handles the authentication flow (Natif on iOS, OAuth redirect on Android/Web)
  • Extracts the identity token from Apple
  • Signs in to Supabase with the identity token

Terminé Implementation

The complete implementation is available in the example app’s supabaseAuthUtils.ts file.

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

The helper function automatically handles platform-specific differences:

  • iOS: Uses Natif Apple Sign-In (no redirect URL needed, uses Bundle ID automatically)
  • Android: Uses OAuth redirect flow with backend edge function (requires Service ID)
  • Web: Uses OAuth popup flow (requires Service ID and current page URL as redirect)

The function returns an identity token from Apple, which is then used to authenticate with Supabase using supabase.auth.signInWithIdToken().