var userInput=req.body["g-recaptcha-response"]? "&response="+req.body["g-recaptcha-response"]:"";
var remoteIp="&remoteip="+req.connection.remoteAddress;
var finalRequest="https://www.google.com/recaptcha/api/siteverify?secret=..."+userInput;//+remoteIp;
request({
uri: finalRequest,
method: "POST",
timeout: 10000,
followRedirect: true,
maxRedirects: 10
}, function(error, response, body) {
console.log(body);
});
--
You received this message because you are subscribed to the Google Groups "reCAPTCHA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to recaptcha+...@googlegroups.com.
To post to this group, send email to reca...@googlegroups.com.
Visit this group at http://groups.google.com/group/recaptcha.
For more options, visit https://groups.google.com/d/optout.
{ "success": true }
!
Then I tried the second request with the same URL(in chrome), it returned that "success": false.
So I suspect when I get no errorCodes, I think something is wrong with "success" return value, even if the actual verification process would be fine. When I provided an empty string or some random string in response parameter in api/siteverify, it returns
{
"success": false,
"error-codes": [
"invalid-input-response"
]
}
This clearly indicates that the verification was erroneous.
After some experiments, if it works fine, I might would rather use this "error-codes" field to make a judgement, instead of "success" field, as long as it can prevent exploitation or random submission of the form.
According to the "verifying the user's response" section of the guide you linked to, you can only verify a response once and it will fail the second time. If that's true, then the fact that it's working the first time you paste the url from the log seems to indicate that something's wrong with the code and it's somehow not sending the parameters properly. Can you post more of the verification code?