メニューに進む

Android セットアップ

GitHub

Create an Android mobile application key in Google Cloud reCAPTCHA. Register the package name used by your Capacitor app, then set the key in capacitor.config.ts.

AndroidはGoogleのモバイルreCAPTCHAを使用しています。SDK。通常の非Enterprise reCAPTCHA v3は、このプラグインでWebのみに利用可能です。 enterprise: false Androidでは拒否されます。

import type { CapacitorConfig } from '@capacitor/cli';
import '@capgo/capacitor-recaptcha';
const config: CapacitorConfig = {
plugins: {
Recaptcha: {
androidSiteKey: 'ANDROID_SITE_KEY',
},
},
};
export default config;

プラグインには、Google Android reCAPTCHA 依存関係が含まれています。

com.google.android.recaptcha:recaptcha:18.8.0

Google の Android reCAPTCHA SDK は、消費者アプリでコアライブラリのデスガージングを必要とします。このプラグインは、自動的に有効にし npx cap sync android コピー

com.android.tools:desugar_jdk_libs:2.1.5

必要な場合にGoogle __CAPGO_KEEP_0__ の新しいリリースを固定することができます。 recaptchaVersion when you need to pin a newer Google SDK release. You can override the desugaring dependency with desugarJdkLibsVersion.

import { Recaptcha } from '@capgo/capacitor-recaptcha';
const { token } = await Recaptcha.execute({
action: 'checkout',
timeout: 10000,
});

Send the token to your backend immediately and create a reCAPTCHA assessment before accepting the protected request.

Keep going from Android Setup

Section titled “”

If you are using Android Setup to plan authentication and account flows, connect it with Using @capgo/capacitor-recaptcha for the native capability in Using @capgo/capacitor-recaptcha, @capgo/capacitor-social-login for the implementation detail in @capgo/capacitor-social-login, @capgo/capacitor-passkey for the implementation detail in @capgo/capacitor-passkey, @capgo/capacitor-native-biometric @capgo/capacitor-native-biometricの実装詳細について Two-factor authentication Two-factor authenticationの実装詳細について