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사이트 키를 구성
사이트 키를 구성Google Cloud reCAPTCHA에서 플랫폼 키를 생성하고 그 키를 추가하세요. 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() 클라이언트가 준비되지 않은 경우 자동으로 호출되므로 명시적 로드 단계는 선택적입니다.
웹 표준 reCAPTCHA v3
웹 표준 reCAPTCHA v3설정 enterprise: false 구글의 표준 웹 reCAPTCHA v3 스크립트를 로드합니다.
const { token } = await Recaptcha.execute({ siteKey: 'WEB_V3_SITE_KEY', enterprise: false, action: 'signup',});안드로이드 및 iOS에서 구글의 네이티브 모바일 SDK 경로는 기업용/모바일 전용입니다. 네이티브 플랫폼에서 전달하는 것은 거부되므로 표준 웹 v3 키가 실수로 사용되지 않도록 합니다. enterprise: false 이동 노트
설정
이동 노트 섹션플러그인은 이전 Cordova 옵션 별칭을 받습니다. sitekeyAndroid 그리고 sitekeyWeb 콜 옵션과 Capacitor 구성에서. sitekeyIos 또한 iOS 마이그레이션 별칭으로도 받습니다. sitekeyIOS 새로운 code을 위해 Capacitor 구성 이름을 선호하세요.
Getting Started에서 계속하기
Getting Started을 사용하여 인증 및 계정 흐름을 계획하고 있다면그것을 @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-recaptcha와 연결하세요. Getting Started Getting Started Using @capgo/capacitor-recaptcha capgo의 원생 기능을 위한 Using @capgo/capacitor-recaptcha, @capgo/capacitor-social-login capgo의 구현 세부 정보를 위한 @capgo/capacitor-social-login, @capgo/capacitor-passkey capgo의 구현 세부 정보를 위한 @capgo/capacitor-passkey, @capgo/capacitor-native-biometric capgo의 구현 세부 정보를 위한 @capgo/capacitor-native-biometric, 그리고 두 단계 인증 __CAPGO_KEEP_0__의 구현 세부 정보를 위한 두 단계 인증.