Passer au contenu

Supabase Apple Login - General Setup

Ce contenu n'est pas encore disponible dans votre langue.

This guide will help 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 Login General Setup guide to setup Apple OAuth credentials

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

  1. Go to your Supabase Dashboard

  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:

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

    Supabase Apple Provider Save

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 (native on iOS, OAuth redirect on Android/Web)
  • Extracts the identity token from Apple
  • Signs in to Supabase with the identity token
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 native 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().