Skip to content

Instantly share code, notes, and snippets.

@nyancodeid
Last active August 8, 2017 08:45
Show Gist options
  • Save nyancodeid/05f8ed8e31035eb5813b05160b3a8aaf to your computer and use it in GitHub Desktop.
Save nyancodeid/05f8ed8e31035eb5813b05160b3a8aaf to your computer and use it in GitHub Desktop.
Google reCaptcha Validator API

Google reCaptcha Validator API

By Ryan Aunur Rassyid

Demo

https://plnkr.co/edit/ivSb5wxcRer3Mhq4fQzr?p=preview

Info

Google reRecaptca Response value

var response = $("#g-recaptcha-response").val();

Changelog

API v1

var apiv1 = "https://script.google.com/macros/s/AKfycbwj3YM5Uhk-pY4XlYzMitcrPAoaoai7vjXbQASGjihtX16LxGg/exec"
var apiv1 = "https://script.google.com/macros/s/AKfycbwj3YM5Uhk-pY4XlYzMitcrPAoaoai7vjXbQASGjihtX16LxGg/exec";
$('#button').click(function () {
$.ajax({
url: apiv1 + '?action=push&secret=YOUR-SECRET-KEY',
method: 'GET',
crossDomain: true,
dataType: 'jsonp'
}).done(function (result) {
$('pre#code').text(JSON.stringify(result, null, 3));
});
});
$('#validate').click(function () {
$.ajax({
url: apiv1 + '?action=validate&token=YOUR-TOKEN-RESPONSE&response=GOOGLE-RECAPTCH-RESPONSE',
method: 'GET',
crossDomain: true,
dataType: 'jsonp'
}).done(function (result) {
$('pre#code').text(JSON.stringify(result, null, 3));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment