An open API service indexing awesome lists of open source software.

https://github.com/kkent030315/hcaptcha-module

hCaptcha integration with Nuxt.js
https://github.com/kkent030315/hcaptcha-module

captcha hcaptcha nuxt nuxt-module nuxt-modules nuxtjs

Last synced: 8 months ago
JSON representation

hCaptcha integration with Nuxt.js

Awesome Lists containing this project

README

          


License
CircleCI
npm
npm bundle size

# hcaptcha-module
hCaptcha integration with Nuxt.js

# Usage

1. Install

```bash
npm i hcaptcha-nuxt
```

or using `yarn`

```bash
yarn add hcaptcha-nuxt
```

2. Add `hcaptcha-nuxt` module in `nuxt.config.js`

```js
export default {
modules: [
"hcaptcha-nuxt"
],
}
```

3. Specify your site key in `nuxt.config.js`

```js
export default {
hcaptcha: {
siteKey: process.env.HCAPTCHA_SITE_KEY || ''
}
}
```

4. Add `` component in `your-component.vue`

```html



```

5. You are ready to go. get the response and send it to the server then validate it

In `your-component.vue`

```html

export default {
methods: {
onSubmit() {
const hcaptcha_response = this.$hcaptcha.getResponse()
}
}
}

```

# Local Development

For local development, as modern browsers have strict CORS CORB,
hCaptcha will not work on `file://somewhere` either `localhost`

add `127.0.0.1 your.domain.com` to the `hosts` to prevent this.

- `/etc/hosts` on Linux,
- `/private/hosts` on OSX,
- `%SystemRoot%/System32/drivers/etc/hosts` on Windows.

# License

MIT