メニューに進む

Getting Started

GitHub

AI-Assisted セットアップを使用してプラグインをインストールできます。AI ツールに Capgo スキルを追加するには、以下のコマンドを実行してください。

ターミナルウィンドウ
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

Then use the following prompt:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-recaptcha` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

ターミナル画面
npm install @capgo/capacitor-recaptcha
npx cap sync

Create platform keys in Google Cloud reCAPTCHA, then add them to capacitor.config.ts.

import type { CapacitorConfig } from '@capacitor/cli';
import '@capgo/capacitor-recaptcha';
const config: CapacitorConfig = {
appId: 'com.example.app',
appName: 'Example',
webDir: 'dist',
plugins: {
Recaptcha: {
androidSiteKey: 'ANDROID_SITE_KEY',
iosSiteKey: 'IOS_SITE_KEY',
webSiteKey: 'WEB_SITE_KEY',
enterprise: true,
},
},
};
export default config;

androidSiteKey, iosSiteKeyoverride the shared webSiteKey . You can also pass a siteKey__CAPGO_KEEP_0__ siteKey __CAPGO_KEEP_0__ load() または execute() 環境に応じてキーが依存する場合。

import { Recaptcha } from '@capgo/capacitor-recaptcha';
const { token } = await Recaptcha.execute({
action: 'login',
});
await fetch('/api/recaptcha-assessment', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ token, action: 'login' }),
});

execute() 呼び出し load() クライアントが準備されていない場合、明示的なプリロードステップは省略可能です。

設定 enterprise: false Googleの標準Web reCAPTCHA v3スクリプトをロードするように設定

const { token } = await Recaptcha.execute({
siteKey: 'WEB_V3_SITE_KEY',
enterprise: false,
action: 'signup',
});

AndroidおよびiOSでは、GoogleのネイティブモバイルSDKパスはエンタープライズ/モバイルのみです。パスする enterprise: false ネイティブプラットフォームでは拒否されるため、標準Web v3キーが誤って使用されないようにします。

移行ノート

移行ノート

プラグインは古いコルダバオプションのエイリアスを受け入れます sitekeyAndroid そして sitekeyWeb コールオプションとCapacitor構成も受け入れます。さらに sitekeyIos そして sitekeyIOS iOS移行エイリアスとしても受け入れます。新しいcodeのためにCapacitor構成名を優先してください。

はじめから始める

はじめから始める

If you are using __CAPGO_KEEP_0__ in __CAPGO_KEEP_1__, Getting Started を使用して認証とアカウントフローの計画を行い、 capgo/capacitor-recaptcha capgo/capacitor-recaptcha capgo/capacitor-social-login capgo/capacitor-social-login capgo/capacitor-passkey capgo/capacitor-passkey capgo/capacitor-native-biometric capgo/capacitor-native-biometric Two-factor authentication __CAPGO_KEEP_0__の実装詳細については、2要素認証のページを参照してください。