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.
インストール
「インストール」のセクションnpm install @capgo/capacitor-recaptchanpx cap sync__CAPGO_KEEP_0__ 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() 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 移行ノート
古いCordovaオプションのエイリアスと sitekeyAndroid コールオプションと__CAPGO_KEEP_0__設定も受け入れます。 sitekeyWeb 古いCordovaオプションのエイリアスとコールオプションとCapacitor設定も受け入れます。 sitekeyIos iOS移行用エイリアスとして使用します。新しい__CAPGO_KEEP_1__のための__CAPGO_KEEP_0__の設定名を優先してください。 sitekeyIOS as iOS migration aliases. Prefer the Capacitor config names for new code.
はじめから始める
「はじめから始める」あなたが使用している場合 はじめから始める 認証とアカウントフローの計画に使用するには、__CAPGO_KEEP_0__と接続します。 Using @capgo/capacitor-recaptcha Using @capgo/capacitor-recaptcha Using @capgo/capacitor-social-login Using @capgo/capacitor-social-login Using @capgo/capacitor-passkey 実装詳細の@capgo/capacitor-passkeyの @capgo/capacitor-native-biometric 実装詳細の@capgo/capacitor-native-biometric、 2要素認証 実装詳細の2要素認証。