Skip to main content
@capgo/capacitor-recaptcha Auth & Security Open source

reCAPTCHA Capacitor plugin

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

Install

bun add @capgo/capacitor-recaptcha bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-recaptcha
  • pnpm add @capgo/capacitor-recaptcha
  • yarn add @capgo/capacitor-recaptcha

Guide

How to use reCAPTCHA in Capacitor

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.

FAQ

reCAPTCHA plugin FAQ

How do I install the reCAPTCHA plugin in a Capacitor app?

Run "bun add @capgo/capacitor-recaptcha" (or "npm install @capgo/capacitor-recaptcha"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-recaptcha" in your app code.

Does @capgo/capacitor-recaptcha work with React, Vue and Angular?

Yes. reCAPTCHA is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-recaptcha support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-recaptcha free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-recaptcha/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses reCAPTCHA without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship reCAPTCHA changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo