Google reCAPTCHA

How to integrate Google reCAPTCHA in your application.

Register a new site

Select Create button inside the Register a new site section.

// import homeRecaptcha from '@/assets/guides/captcha/google.png';

Add your domain and select the reCAPTCHA type you want to use.

Add keys to .env

Add the keys to your .env file.

CAPTCHA_SECRET_KEY=XXX
CAPTCHA_SITE_KEY=XXX

Provide keys to VitNode

Edit your app.module.ts file and add captcha object to the VitNodeModule configuration.

@Module({
  imports: [
    VitNodeCoreModule.register({
      database: {
        config: DATABASE_ENVS,
        schemaDatabase,
      },
      captcha: {
        type: 'recaptcha_v3', // or 'recaptcha_v2_invisible' or 'recaptcha_v2_checkbox'
        site_key: process.env.CAPTCHA_SITE_KEY,
        secret_key: process.env.CAPTCHA_SECRET_KEY,
      },
    }),
    DatabaseModule,
    PluginsModule,
    CacheModule.register({
      isGlobal: true,
    }),
  ],
})
export class AppModule {}

On this page