【问题标题】:Send recaptcha secret in POST body instead of URL parameters在 POST 正文中发送 recaptcha 密码而不是 URL 参数
【发布时间】:2019-03-31 12:31:21
【问题描述】:

当我将值作为 URL 参数传递时,ReCaptcha 的服务器集成运行良好。

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

当我在 POST 正文中将值作为 JSON 传递时,请求失败。

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

到目前为止我看到的示例代码建议使用 URL 参数,但没有解释为什么不支持 JSON POST 正文。

Google's FAQ 也没有列出,我想知道我是否做错了什么。甚至可以通过JSON请求吗?

【问题讨论】:

    标签: recaptcha recaptcha-v3


    【解决方案1】:

    Google 的 recaptcha api 不支持 json body。他们希望您将正文作为查询参数发送。

    例如:

    • POST 请求。
    • 正文:'secret=xxxxxxxxxxxxxxxxxx&response=xxxxxxxxxxxxxxxxxxxxxxxxxx'
    • 标题:'Content-Type':'application/x-www-form-urlencoded'

    【讨论】:

    • 您是否知道或有 recaptcha 说明为什么不支持 json 正文?
    • 如果您问为什么不支持 JSON 正文,那么这就是 google 的决定。
    猜你喜欢
    • 2019-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-14
    • 2018-03-17
    • 2021-11-13
    • 2015-07-27
    相关资源
    最近更新 更多