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
- Host: GitHub
- URL: https://github.com/kkent030315/hcaptcha-module
- Owner: kkent030315
- License: mit
- Created: 2021-03-12T14:53:27.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-12T22:05:35.000Z (over 4 years ago)
- Last Synced: 2025-02-12T09:18:42.947Z (8 months ago)
- Topics: captcha, hcaptcha, nuxt, nuxt-module, nuxt-modules, nuxtjs
- Language: Vue
- Homepage:
- Size: 132 KB
- Stars: 7
- Watchers: 4
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
![]()
![]()
![]()
# 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