I have requirement to add Recaptcha in Lightning Web Component component. I have used V3 of google recaptacha. I have added https://www.google.com/recaptcha/api.js url in static resource and referenced in LWC component.
On running this is showing
"Access to XMLHttpRequest at 'https://www.gstatic.com/recaptcha/api2/v1550471573786/recaptcha__en.js' from origin 'https://******–*****–livepreview.cs77.force.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."
I have added url in CORS,CSP sites and Remote site setting. Can any one help in this issue.
Best Answer
I have a solution that you can try.
Upload a static resource: recaptcha2.html
You will need to create a resource file called: recaptcha2.resource-meta.xml
Make an LWC component: captcha.html
and the JavaScript: captcha.js
I hadn't used a captcha prior, when registering the domain I didn't realize that I should leave off the https://.