Cloudflare Turnstile integration for Nuxt 2
npm install nuxt2-turnstile[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href]
[![Codecov][codecov-src]][codecov-href]
[![License][license-src]][license-href]
> Cloudflare Turnstile integration for Nuxt 2
1. Add nuxt2-turnstile dependency to your project
``bash`
yarn add nuxt2-turnstile # or npm install nuxt2-turnstile
2. Add nuxt2-turnstile at the end of modules section of nuxt.config.js
`js
{
modules: [
// ...other modules here
// Simple usage
'nuxt2-turnstile',
// With options
['nuxt2-turnstile', { / module options / }],
],
// add your Cloudflare Turnstile keys using runtime config
privateRuntimeConfig: {
turnstile: {
// DO NOT PUT THIS IN PUBLIC RUNTIME CONFIG
secretKey: '
},
},
publicRuntimeConfig: {
turnstile: {
siteKey: '
},
},
}
`
To use Turnstile, add the auto-imported Vue component in whatever component needs it:
`html`
It renders the Turnstile