function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tony White (BNE)Tony White (BNE) 

Can you add Google reCaptcha to a custom lightning component?

I am needing to add a reCaptcha test in a Lightning community, but with the locker service the script has to be loaded from a static resource rather than directly from the Google website... but is that going to break it?  Guessing the only way to know is to try but would be good to know if others have tried already...
Best Answer chosen by Tony White (BNE)
NagendraNagendra (Salesforce Developers) 
Hi Tony,

Serve reCaptcha's api.js file locally (as a javascript static resource) does prevent correct behavior.

api.js has a magic URL in it that changes periodically, so it does need to be either updated very frequently or served from google's servers.

Source: http://stackoverflow.com/questions/27613461/is-serving-google-no-captcha-recaptchas-api-js-locally-preventing-correct-behav

Please mark this as solved if the information helps.

Regards,
Nagendra.

All Answers

NagendraNagendra (Salesforce Developers) 
Hi Tony,

Serve reCaptcha's api.js file locally (as a javascript static resource) does prevent correct behavior.

api.js has a magic URL in it that changes periodically, so it does need to be either updated very frequently or served from google's servers.

Source: http://stackoverflow.com/questions/27613461/is-serving-google-no-captcha-recaptchas-api-js-locally-preventing-correct-behav

Please mark this as solved if the information helps.

Regards,
Nagendra.
This was selected as the best answer
Tony White (BNE)Tony White (BNE)
Thanks Nagendra, I will update this once I have received confirmation from the development team as I have also raised this question directly with them - https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?fId=0D53A00002wcbEd&g=0F9300000009Pei
I am hoping there is a work around that can be used...
Tony White (BNE)Tony White (BNE)
Quick update from one of the Saleforce folks - "In *safe harbor* we are looking at introducing "out-of-the-box" supported functionality for reCAPTCHA (likely via a custom lightning component) in the Summer '17 release."

Fingers crossed we will see something like that...