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.
インストール
インストールYou can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:
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コピー
サイト キーを設定サイト キーを設定するセクション 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, and webSiteKey override the shared siteKey. You can also pass a siteKey directly to load() or execute() when the key depends on your environment.
Generate A Token
Section titled “Generate A Token”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() calls load() automatically when the client is not ready, so an explicit preload step is optional.
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パスはエンタープライズ/モバイルのみです。ネイティブプラットフォームでパスすることは拒否されるため、標準Web v3キーが誤って使用されないようにします。 enterprise: false 移行ノート
コールオプションと__CAPGO_KEEP_0__設定にも認識します。 sitekeyAndroid と sitekeyWeb in call options and Capacitor config. It also accepts sitekeyIos と sitekeyIOS iOS移行用エイリアスとして利用します。新しいCapacitorの設定名をcodeの設定名に優先してください。
Getting Startedから続けてください
Getting Startedから続けてくださいCapgoを使用している場合 Getting Started 認証とアカウントフローの計画に使用するには、Capacitorを__CAPGO_KEEP_0__に接続してください。 @capgo/capacitor-recaptcha Capacitorのネイティブ機能として使用する@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 Two-factor authenticationの実装詳細について