Getting Started
このプラグインのインストール手順とマークダウンガイドの全てを含むセットアップコマンドをコピーできます。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-recaptcha`
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/recaptcha/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-recaptcha` plugin in my project.手動設定を使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
npm install @capgo/capacitor-recaptchanpx cap syncサイトキーを設定
「サイトキーを設定」のセクションGoogle Cloud reCAPTCHAでプラットフォームキーを作成し、次にそれを 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, iosSiteKey、 webSiteKey 共有設定を上書き siteKeyを上書きすることもできます。 siteKey 直接を 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() 呼び出し
クライアントが準備されていない場合、自動的にプレロードステップが実行され、明示的なプレロードステップは省略可能です。
Web Standard reCAPTCHA v3設定 enterprise: false Googleの標準Web reCAPTCHA v3スクリプトを読み込む
const { token } = await Recaptcha.execute({ siteKey: 'WEB_V3_SITE_KEY', enterprise: false, action: 'signup',});AndroidおよびiOSでは、GoogleのネイティブモバイルSDKパスはエンタープライズ/モバイルのみです。SDKをパスとして渡すと enterprise: false 移行ノート
、 sitekeyAndroid and sitekeyWeb コールオプションとCapacitorの設定も受け入れます。 sitekeyIos and sitekeyIOS iOS マイグレーション アリーシャ。新しい code の Capacitor 設定名を優先してください。
次に進む
「次に進む」あなたが使用している Getting Started 認証とアカウントフローの計画に使用している場合は Capgoで使用する@capgo/capacitor-recaptcha native capabilityの@capgo/capacitor-recaptcha @capgo/capacitor-ソーシャルログイン @capgo/capacitor-social-loginの実装詳細 @capgo/capacitor-パスキー @capgo/capacitor-passkeyの実装詳細 @capgo/capacitor-native-biometric for the implementation detail in @capgo/capacitor-native-biometric, and 二要素認証 Capacitor-native-biometricの実装詳細については