コンテンツにスキップ

Getting Started

GitHub

インストール

インストール

You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:

__CAPGO_KEEP_0__スキルをAIツールに追加するには、以下のコマンドを実行してください:
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.

コピー

Manual セットアップを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の説明を参照してください:
npm install @capgo/capacitor-recaptcha
npx 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.

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__設定にも認識します。 sitekeyAndroidsitekeyWeb in call options and Capacitor config. It also accepts sitekeyIossitekeyIOS 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の実装詳細について