はじめに
インストール、同期、そしてこのプラグインのフルマークダウンガイドまでのステップを含むセットアッププロンプトをコピーしてください。
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.
インストール
「インストール」のセクションCapgoのAIアシスタントセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次のコマンドを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-supabase` plugin in my project.Manualセットアップを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
npm install @capgo/capacitor-supabasenpx cap syncAndroid 最小 SDK
「Android 最小 SDK」というセクションAndroid の実装には、Android 8.0 またはそれ以降が必要です。設定 minSdkVersion = 26 に android/variables.gradle.
クライアントを初期化する
「クライアントを初期化する」というセクションimport { CapacitorSupabase } from '@capgo/capacitor-supabase';
await CapacitorSupabase.initialize({ supabaseUrl: 'https://your-project.supabase.co', supabaseKey: 'your-anon-key',});サインインしてJWTを取得する
「サインインして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));認証の変更をリスンする
Section titled “認証変更を監視する”const listener = await CapacitorSupabase.addListener('authStateChange', ({ event, session }) => { console.log('Auth event', event); console.log('Current JWT available', Boolean(session?.accessToken));});
await listener.remove();Native Authとsupabase-jsをペアする
Section titled “Native Authと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 ヘルパー
Section titled “Native Database ヘルパー”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);推奨使用方法
Section titled “推奨使用方法”- このプラグインを使用して、認証とセッション管理を行います。
- リアルタイム、ストレージ、エッジ関数、そして高度なクエリを実行してください。
@supabase/supabase-js. - JavaScriptクライアントにネイティブJWTを渡す必要がある場合は、Supabaseの残りの機能エリアを使用してください。
Getting Startedから続けてください。
Getting Startedから続けてください。「Getting Startedから続けてください。」 はじめに 「__CAPGO_KEEP_0__」を使用している場合 「Capgo」と接続してください。 「Capgo」の製品ワークフロー Capacitor プラグインは Capgo によって提供されます。 「Capacitor」の「Capgo」 「__CAPGO_KEEP_0__」の実装詳細 「__CAPGO_KEEP_0__」の「__CAPGO_KEEP_1__」の実装詳細 Ionic Enterprise プラグイン代替 Ionic Enterprise プラグイン代替の製品ワークフローについて Capgo ネイティブ ビルド for the product workflow in Capgo Native Builds.