__CAPGO_KEEP_0__ - __CAPGO_KEEP_1__ アプリのリアルタイム更新

Getting Started

GitHub

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 Setup を使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。

ターミナルウィンドウ
npm install @capgo/capacitor-supabase
npx cap sync

Android の実装では、Android 8.0 またはそれ以降が必要です。設定 minSdkVersion = 26 in android/variables.gradle.

import { CapacitorSupabase } from '@capgo/capacitor-supabase';
await CapacitorSupabase.initialize({
supabaseUrl: 'https://your-project.supabase.co',
supabaseKey: 'your-anon-key',
});
const { session, user } = await CapacitorSupabase.signInWithPassword({
email: 'user@example.com',
password: 'password123',
});
console.log('User', user?.id);
console.log('JWT available', Boolean(session?.accessToken));
const listener = await CapacitorSupabase.addListener('authStateChange', ({ event, session }) => {
console.log('Auth event', event);
console.log('Current JWT available', Boolean(session?.accessToken));
});
await listener.remove();
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);
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);
  • Use this plugin for authentication and session management.
  • リアルタイム、ストレージ、エッジ関数、そして高度なクエリを保持する @supabase/supabase-js.
  • native JWTをJavaScriptクライアントに渡すことで、Supabaseの残りの機能領域を利用できます。

Getting Startedから続けてください

Getting Startedから続けてください

Capgoを使用している場合 Getting Started Capgoを使用している場合 Capgo プラグインディレクトリ Capgo プラグインディレクトリの製品ワークフロー Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, プラグインの追加または更新 for the implementation detail in Adding or Updating Plugins、 Ionic Enterprise Plugin Alternatives for the product workflow in Ionic Enterprise Plugin Alternatives、そして Capgo Native Builds for the product workflow in Capgo Native Builds。