0

Server Integration of ReCaptcha works well when I pass values as URL parameters.

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

The request fails when I pass values as JSON in POST body.

{
  "success": true,
  "challenge_ts": "2018-10-26T16:01:24Z",
  "hostname": "testkey.google.com"
}

Sample code I have seen so far suggests using URL parameters but does not explain why JSON POST body is not supported.

Google's FAQ does not list it either, I am wondering if I am doing something wrong. Is it even possible to request through JSON?

Lordbalmon
  • 1,634
  • 1
  • 14
  • 31

1 Answers1

4

Google's recaptcha api does not support json body. They expect you to send the body as query params.

For example:

  • POST request.
  • Body: 'secret=xxxxxxxxxxxxxxxx&response=xxxxxxxxxxxxxxxxxxxxxxxxxx'
  • Header: 'Content-Type': 'application/x-www-form-urlencoded'