So we are using google ReCaptcha in our site, but for one country it's returning as [invalid-input-response] error, but for the same code flow for another site it's working fine. I saw others also raised this similar issue but there are no responses, also google ReCaptcha support mail is also invalid in their support site. I hope I get some solution/response to my query here. I checked the site key and the secret key and they are correct. Again I repeat, this code worked perfectly. What can be causing this issue?
Any kind of response is appreciated. Thanks.
I solved it for myself!
As I write this in 2025, it looks like Google documentation forgets to mention one crucial thing. When you send your POST request for verification (that includes your secret key and response token from the frontend), DO NOT send it in usual JSON format. It doesn't parse it!
Therefore, instead of this:
{
headers: { 'Content-Type': 'application/json' },
}
Use this:
{
headers: { "Content-Type": "application/x-www-form-urlencoded" },
}
This is a format, where key-value pairs encoded in a query string-like format:
secret=your-secret-key&response=captcha-response-token
By the way [invalid-input-response] error, just from Google docs means - "The response parameter is invalid or malformed." And why it could be malformed, they didn't mention :)
Hope it helps you, whoever reads it!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With