nuxt-community / recaptcha-module

🤖 Simple and easy Google reCAPTCHA integration with Nuxt.js
MIT License
253 stars 64 forks source link

Unable to load script with V2 Enterprise #107

Open afiqiqmal opened 2 years ago

afiqiqmal commented 2 years ago

https://www.google.com/recaptcha/enterprise.js?render=KEY will give error. Any workaround?

mvrlin commented 2 years ago

https://www.google.com/recaptcha/enterprise.js?render=KEY will give error. Any workaround?

Hello, what's the error?

afiqiqmal commented 2 years ago

If you have enterprise v2 key,

https://www.google.com/recaptcha/enterprise.js?render=KEY will give 400 bad request

To make it works with this library. i have to do some trick where you cannot put siteKey in nuxt.config.js

recaptcha: {
    siteKey: 'explicit',  // put anything beside key
    version: 2,
    mode: 'enterprise'
},

In component:

<recaptcha id="v2-normal"/>
await this.$recaptcha.init()
this.widgetId = this.$recaptcha.render('v2-normal', {
    sitekey: process.env.GOOGLE_RECAPTCHA_KEY
});

This will works with v2 enterprise.