Skip to main content
Back to plugins
@capgo/capacitor-recaptcha
Tutorial
@capgo/capacitor-recaptcha

reCAPTCHA

Generate Web reCAPTCHA or reCAPTCHA Enterprise tokens plus native Enterprise mobile tokens

Guide

Tutorial on reCAPTCHA

Test on device

Download the Capgo app, then scan the QR code.

reCAPTCHA plugin preview QR code

Using @capgo/capacitor-recaptcha

Generate reCAPTCHA and reCAPTCHA Enterprise tokens from Web, Android, and iOS Capacitor apps.

Install

npm install @capgo/capacitor-recaptcha
npx cap sync

Configure

import type { CapacitorConfig } from '@capacitor/cli';
import '@capgo/capacitor-recaptcha';

const config: CapacitorConfig = {
  plugins: {
    Recaptcha: {
      androidSiteKey: 'ANDROID_SITE_KEY',
      iosSiteKey: 'IOS_SITE_KEY',
      webSiteKey: 'WEB_SITE_KEY',
      enterprise: true,
    },
  },
};

export default config;

Use enterprise: false only when the Web implementation should load standard reCAPTCHA v3 instead of reCAPTCHA Enterprise. Android and iOS use Google's Enterprise/mobile SDK path and reject enterprise: false.

Generate A Token

import { Recaptcha } from '@capgo/capacitor-recaptcha';

const { token } = await Recaptcha.execute({
  action: 'login',
});

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

Full Reference

Keep going from Using @capgo/capacitor-recaptcha

If you are using Using @capgo/capacitor-recaptcha to plan authentication and account flows, connect it with @capgo/capacitor-recaptcha for the implementation detail in @capgo/capacitor-recaptcha, Getting Started for the implementation detail in Getting Started, @capgo/capacitor-social-login for the implementation detail in @capgo/capacitor-social-login, @capgo/capacitor-passkey for the implementation detail in @capgo/capacitor-passkey, and @capgo/capacitor-native-biometric for the implementation detail in @capgo/capacitor-native-biometric.