1

I want to use google's v2 recaptcha with angularjs and check if the form has been filled out before sending to my server.

So... when the user clicks create my account I want to check g-recaptcha-response before I send to my server.

Similar to this example. How can I validate google reCAPTCHA v2 using javascript/jQuery?

I want to have a solution in my angularjs controller.

I looked around at several examples but still have lots of questions.

https://developers.google.com/recaptcha/docs/verify

Google docs are a bit difficult to use.

I would also like to just figure it out and not use any other solutions. ie - http://code.ciphertrick.com/2015/05/19/google-recaptcha-with-angularjs/

<script src='https://www.google.com/recaptcha/api.js' async defer ></script>


   ...form here..


            <div class="signup-profile-row-left" style="margin-bottom: 12px;">
              <div class="g-recaptcha" data-sitekey="youGoogleKeyHere" ></div>
            </div>



            <div class="signup-profile-row-left" style="margin-bottom: 12px;">
              <button class="row-left btn btn-primary" type="submit">Create My Account</button>
            </div>
          </form>
        </div>
Community
  • 1
  • 1
philipfwilson
  • 757
  • 2
  • 9
  • 21

1 Answers1

3

I did not get any response so I decided to try a few of my own.

http://code.ciphertrick.com/2015/05/19/google-recaptcha-with-angularjs/

I started with this and then went straight to the Google docs. It took a while but I think I have it working now without any other tools.

Interesting. I think next I will work with the Token.

A reCAPTCHA key is normally tied to a set of individual domains. However, you might have a large number of hosted domains and would like to have one key working on all of them - the solution is the secure token.

Use the secure token to request a CAPTCHA challenge from any domain. By encrypting the secure token with your site secret you can prevent a spammer from requesting CAPTCHAs on your behalf.

philipfwilson
  • 757
  • 2
  • 9
  • 21