Getting Started
Copas prompt pengaturan dengan langkah instalasi dan panduan markdown lengkap untuk plugin ini.
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.
Instal
Bagian berjudul “Instal”Anda dapat menggunakan Setup Bantuan AI kami untuk menginstal plugin ini. Tambahkan Capgo kemampuan ke alat AI Anda menggunakan perintah berikut:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsLalu gunakan prompt berikut:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-recaptcha` plugin in my project.Jika Anda lebih suka Setup Manual, instal plugin dengan menjalankan perintah-perintah berikut dan ikuti instruksi spesifik platform di bawah ini:
npm install @capgo/capacitor-recaptchanpx cap syncKonfigurasi Kunci Situs
Bagian berjudul “Konfigurasi Kunci Situs”Buat kunci platform di Google Cloud reCAPTCHA, kemudian tambahkan ke 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, iosSiteKeydan webSiteKey mengganti nilai yang telah dibagikan siteKey. Anda juga dapat melewati nilai tersebut secara langsung ke siteKey langsung ke load() atau execute() atau
menghasilkan Token
Bagian berjudul “Menghasilkan 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() menghasilkan panggilan load() otomatis ketika klien belum siap, sehingga langkah pra-muat ulang eksplisit tidak wajib.
reCAPTCHA Web Standar v3
Judul Bagian: “Standar Web reCAPTCHA v3”Set enterprise: false Untuk memuat skrip standar Web reCAPTCHA v3 dari Google.
const { token } = await Recaptcha.execute({ siteKey: 'WEB_V3_SITE_KEY', enterprise: false, action: 'signup',});On Android and iOS, Google’s native mobile SDK path is Enterprise/mobile only. Passing enterprise: false Catatan Migrasi
Judul Bagian: “Catatan Migrasi”
Plugin ini menerima nama pilihan Cordova yang sudah usangdan sitekeyAndroid di pilihan panggilan dan konfigurasi __CAPGO_KEEP_0__. Selain itu, plugin ini juga menerima sitekeyWeb in call options and Capacitor config. It also accepts sitekeyIos context sitekeyIOS sebagai alias migrasi iOS. Gunakan nama konfigurasi Capacitor untuk code baru.
Teruskan dari Getting Started
Bab: Teruskan dari Getting StartedJika Anda menggunakan Getting Started untuk merencanakan autentikasi dan alur akun, hubungkannya dengan Menggunakan @capgo/capacitor-recaptcha untuk kemampuan native di Menggunakan @capgo/capacitor-recaptcha, @capgo/capacitor-social-login untuk detail implementasi di @capgo/capacitor-social-login, @capgo/capacitor-passkey untuk detail implementasi di @capgo/capacitor-passkey, capgo/capacitor-native-biometric untuk detail implementasi di capgo/capacitor-native-biometric, dan Dua Faktor Autentikasi untuk detail implementasi di Dua Faktor Autentikasi.