1.0.4 • Published 10 months ago

expo-supabase-social-auth v1.0.4

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

expo-supabase-social-auth

Package for supplying Social Authentication (currently Apple & Google) with Supabase and Expo Router V2. I've written a blog post that explains the process of setting up and configuring Google and Apple logins with Supabase.

Also created an example repository to quickly get started.

Dependencies

This package requires the following dependencies:

Usage

// app/index.tsx
import { useSupabaseSocialAuth } from 'expo-supabase-social-auth';

export default function AuthScreen() {
  const { loading, onSignInWithApple, onSignInWithGoogle } = useSupabaseSocialAuth();

  return (
    <SupabaseSocialAuthProvider
      onLoginError={() => {}}
      onLoginSuccess={() => {}}
      applicationId={applicationId!}
      loggedInRoute="/home/"
      loggedOutRoute="/"
      supabaseClient={supabase}
    >
      {children}
    </SupabaseSocialAuthProvider>
  );
}

Props

MethodTypeDescription
applicationIdstringbundleId/packageName as e.g. com.test
loggedInRoutestringInternal route (Expo app dir) to redirect to after successful login
loggedOutRoutestringInternal route (Expo app dir) to redirect to after logout
onLoginError(error: unknown) => voidCallback function after login error
onLoginSuccess(payload: AuthTokens) => void)Callback function after login success
supabaseClientSupabaseClientSupabase initialized client