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.
インストール
「インストール」のセクションAI-Assisted セットアップを使用してプラグインをインストールできます。AI ツールに Capgo スキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsThen 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-recaptchanpx cap syncConfigure Site Keys
「Configure Site Keys」というセクション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() クライアントが準備されていない場合、明示的なプリロードステップは省略可能です。
Web Standard reCAPTCHA v3
セクション: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パスはエンタープライズ/モバイルのみです。パスする 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要素認証のページを参照してください。