Getting Started
Copy a setup prompt with the install steps and the full markdown guide for this plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-supabase`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/supabase/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Install
Section titled “Install”npm install @capgo/capacitor-supabasenpx cap syncAndroid Minimum SDK
Section titled “Android Minimum SDK”The Android implementation requires Android 8.0 or newer. Set minSdkVersion = 26 in android/variables.gradle.
Initialize The Client
Section titled “Initialize The Client”import { CapacitorSupabase } from '@capgo/capacitor-supabase';
await CapacitorSupabase.initialize({ supabaseUrl: 'https://your-project.supabase.co', supabaseKey: 'your-anon-key',});Sign In And Access The JWT
Section titled “Sign In And Access The JWT”const { session, user } = await CapacitorSupabase.signInWithPassword({ email: 'user@example.com', password: 'password123',});
console.log('User', user?.id);console.log('JWT available', Boolean(session?.accessToken));Listen For Auth Changes
Section titled “Listen For Auth Changes”const listener = await CapacitorSupabase.addListener('authStateChange', ({ event, session }) => { console.log('Auth event', event); console.log('Current JWT available', Boolean(session?.accessToken));});
await listener.remove();Pair Native Auth With supabase-js
Section titled “Pair Native Auth With supabase-js”import { createClient } from '@supabase/supabase-js';
const { session } = await CapacitorSupabase.getSession();
const supabase = createClient('https://your-project.supabase.co', 'your-anon-key', { global: { headers: { Authorization: `Bearer ${session?.accessToken}`, }, },});
const { data } = await supabase.from('table').select('*');console.log(data);Native Database Helpers
Section titled “Native Database Helpers”const { data, error } = await CapacitorSupabase.select({ table: 'users', columns: 'id, name, email', filter: { active: true }, limit: 10, orderBy: 'created_at', ascending: false,});
console.log(data, error);Recommended Usage
Section titled “Recommended Usage”- Use this plugin for authentication and session management.
- Keep Realtime, Storage, Edge Functions, and advanced querying in
@supabase/supabase-js. - Pass the native JWT into the JavaScript client whenever you need the rest of the Supabase surface area.