vue-recaptcha-v3 | A simple and easy to use reCAPTCHA library | Form library
kandi X-RAY | vue-recaptcha-v3 Summary
kandi X-RAY | vue-recaptcha-v3 Summary
A simple and easy to use reCAPTCHA (v3 only) library for Vue.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of vue-recaptcha-v3
vue-recaptcha-v3 Key Features
vue-recaptcha-v3 Examples and Code Snippets
Community Discussions
Trending Discussions on vue-recaptcha-v3
QUESTION
I am a beginner in vue.js 3. I am trying to use vue-recaptcha-v3 which seems popular. But I do not understand how to use it.
In my main.js
, I have :
ANSWER
Answered 2020-Dec-27 at 22:00That seems to indicate a misconfigured site key. Also, there's no VueReCaptcha
component (vue-recaptcha-v3
is only a plugin that provides API methods), so don't add to your template.
Based on the docs, these are the steps I took that worked for me:
Sign up for an API key pair for your site.
For Label, enter a label for the key (e.g.,
Codesandbox Demo
)For reCAPTCHA Type, choose reCAPTCHA v3.
For Domains, enter the domain where the key will be used (e.g.,
csb.app
for Codesandbox), and click the+
icon.Check the box for Accept the reCAPTCHA Terms of Service.
Click Submit.
In your component, use the Composition API to setup your reCAPTCHA:
QUESTION
In my VueJS app with the node module vue-recaptcha-v3
, reCAPTCHA v3 constantly fails in the verification step. The "protected by reCAPTCHA" banner appears on the page like it should, and the response I get before the verification step is fine. When I try to POST
the token to https://www.google.com/recaptcha/api/siteverify
via fetch
:
ANSWER
Answered 2020-Mar-17 at 13:25Ok, I finally found the answer here at StackOverflow: reCAPTCHA - error-codes: 'missing-input-response', 'missing-input-secret' when verifying user's response (missing details on POST) - long story short: Googles reCAPTCHA verification server only seems to accept "Content-Type": "application/x-www-form-urlencoded"
, so the data sent in my case needs to be
body: 'secret=' + secretKey + '&response=' + response
.
With these settings no error occurs (Please note: Data sent like this needs to be sanitized vie URLencode! I left that out in this example.) But still it's confusing that e.g. Firefox shows the correct response from Google, but the Vue application can't read it at all - response.ok euqals false!
The reason: The browser/client can't deal with a no-cors
response by itself. The server has to do this! So the reCAPTCHA response has to be sent to your server and the server (e.g. PHP) has to send the data to Google's verification script. There's no other way around this. Google reCAPTCHA's docs are missing all these important points.
Also - to my own shame I just realized this now - it totally makes sense, because for the reCAPTCHA validation you need your secret reCAPTCHA key, and that one should definitely not be stored in your JS application that's sent to the client. You never give away your secret.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install vue-recaptcha-v3
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page