recaptcha v2 - always returns { "success": false, "error-codes": [ "missing-input-response", "missing-input-secret" ] }

29,884 views
Skip to first unread message

amit motgi

unread,
Jul 29, 2015, 9:21:08 PM7/29/15
to reCAPTCHA
Hello Recaptcha Team,

   I am trying to use the recaptcha-v2. When I am trying to do a siteverify on the server side I get the error  with error-codes => "missing-input-response" & "missing-input-secret" .

   Is the payload format correct? What am I missing here? 

   I know that "g-recaptcha-response" must be sent only once. Not able to see what I am missing here. Any help would be really appreciated.


REQUEST

METHOD
========
POST

API
====

Payload
========
{
  "response":"03AHJ_...xxxxxxx",
  "secret":"6Lc4UAoTAAAAACxxxxx........NrhS"
}

========================================================

RESPONSE
==========

{
"success": false, "error-codes": [ "missing-input-response", "missing-input-secret" ] }


Thanks,
  Amit Motgi









amit motgi

unread,
Aug 4, 2015, 3:08:51 PM8/4/15
to reCAPTCHA
Following is the fix:

POST param is not JSON, it must be passed like a GET param :-)

postParam = "secrect=XXXX&response=YYYY....";

Set Header:
"Content-Type", "application/x-www-form-urlencoded; charset=utf-8"

dkin...@gmail.com

unread,
Oct 13, 2015, 10:50:34 AM10/13/15
to reCAPTCHA
Hey, I hate to bother you, but I'm having some trouble figuring out the server-side aspects of reCAPTCHA. The client side was easy enough, and I can see where the script is updating the text in the HTML object. I have been looking for working examples of verification code in JavaScript, because that's what I know best, but found nothing. Is yours in PHP? Sorry, I'm more of a media guy than coder! LOL Would it be possible for you to send me a redacted (no live keys) copy of your server-side script that I could plug-and-play? I would be most grateful. Thanks for your consideration.

Cheers,
- DK

Peter Van Hove

unread,
Sep 11, 2016, 12:02:54 PM9/11/16
to reCAPTCHA
The requested php code:

   $post_data = "secret=__secret-key__&response=".$_POST['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR'] ;

    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify");
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded; charset=utf-8', 'Content-Length: ' . strlen($post_data)));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    $googresp = curl_exec($ch);      
    $decgoogresp = json_decode($googresp);
    curl_close($ch);

if ($decgoogresp->success == true)
  {
  // Captcha accepted
  }
else
  {
  // Let the user know ...
  }
Message has been deleted

Prabin Shrestha

unread,
Jun 28, 2017, 2:15:03 AM6/28/17
to reCAPTCHA
========
POST
If you see my attachment here is how i solve the issue with volley library in android( it works with StringRequest) but when i use JSONObjectRequest it gives above error
 
Screenshot_२०१७०६२८_११५७०४.png

Jen Sharp

unread,
Jun 28, 2017, 9:28:00 AM6/28/17
to reCAPTCHA
I'm getting failed responses on every submit as well. I'm using the test site key and secret here:
And the client side succeeds, then the php page I send to always fails. I have a very simple php script there now, and it always fails.
sendcontact.php

I've tried many example solutions, even with just a plain form on a blank page, but it always comes back failed. Is there something server side missing? Or could I have set up the key wrong in my account? I have no feedback about why this fails.

Ideas?
Message has been deleted

amit motgi

unread,
Nov 30, 2017, 2:00:35 PM11/30/17
to reca...@googlegroups.com
Following is the fix:

POST param is not JSON, it must be passed like a GET param :-)

postParam = "secrect=XXXX&response=YYYY....";

Set Header:
"Content-Type", "application/x-www-form-urlencoded; charset=utf-8".

Re-posting again... my second comment
On Thu, Nov 23, 2017 at 6:10 AM Unmesh Chougule <chougul...@gmail.com> wrote:
Hi amit,
Please explain what do you menat by "it must be passed like GET param" should I send it via query params or in the request body? If in the request  body then how?
--
You received this message because you are subscribed to a topic in the Google Groups "reCAPTCHA" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/recaptcha/yEPN3d9ylT8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to recaptcha+...@googlegroups.com.
To post to this group, send email to reca...@googlegroups.com.
Visit this group at https://groups.google.com/group/recaptcha.
For more options, visit https://groups.google.com/d/optout.

Юрий Калнин

unread,
Sep 24, 2018, 2:06:15 PM9/24/18
to reCAPTCHA
Большое спасибо!

понедельник, 12 сентября 2016 г., 0:02:54 UTC+8 пользователь Peter Van Hove написал:
Reply all
Reply to author
Forward
0 new messages