npm.io
1.0.4 • Published 3 years ago

expo-supabase-social-auth

Licence
Version
1.0.4
Deps
7
Size
16 kB
Vulns
0
Weekly
0

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
Method Type Description
applicationId string bundleId/packageName as e.g. com.test
loggedInRoute string Internal route (Expo app dir) to redirect to after successful login
loggedOutRoute string Internal route (Expo app dir) to redirect to after logout
onLoginError (error: unknown) => void Callback function after login error
onLoginSuccess (payload: AuthTokens) => void) Callback function after login success
supabaseClient SupabaseClient Supabase initialized client