【问题标题】:Google reCAPTCHA Enterprise Unknown field error when Create Assessment创建评估时出现 Google reCAPTCHA Enterprise Unknown field 错误
【发布时间】:2021-02-23 17:37:58
【问题描述】:

我确实在https://googleapis.dev/ruby/google-cloud-recaptcha_enterprise-v1/latest/index.html 上关注了他们的文档

我首先添加了环境变量RECAPTCHA_ENTERPRISE_CREDENTIALS 然后运行

client = ::Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

文档说response = client.create_assessment request,但文档没有添加示例请求,所以我确实假设它看起来像本文档中的https://cloud.google.com/recaptcha-enterprise/docs/create-assessment

{
  "event": {
    "token": "token",
    "siteKey": "key"
  }
}

但是当我执行client.create_assessment 时,它给了我错误ArgumentError: Unknown field name 'event' in initialization map entry.

我也尝试关注这个https://googleapis.dev/ruby/google-cloud-recaptcha_enterprise-v1/latest/Google/Cloud/RecaptchaEnterprise/V1/RecaptchaEnterpriseService/Client.html#create_assessment-instance_method 其中参数是请求,也给了我错误ArgumentError: Unknown field name 'request' in initialization map entry.

创建评估的正确参数/请求可能是什么?

我使用的宝石是google-cloud-recaptcha_enterprise-v1google-cloud-recaptcha_enterprise

【问题讨论】:

    标签: ruby-on-rails google-cloud-platform recaptcha recaptcha-enterprise


    【解决方案1】:

    所以我使用client.create_assessment(parent: "projects/{your project-id}", assessment: event) 解决了这个问题,我的事件值是event = Google::Cloud::RecaptchaEnterprise::V1::Event.new(token: "token from execute", site_key: "your site key")

    它解决了错误并回答了问题(但在此之后发生了另一个关于权限被拒绝的错误)。解决后我会更新。

    【讨论】:

    • 回来帮助我们!从 GCP 平台外部使用企业验证码的文档也可以用克林贡语编写
    • @bxorcloud 您是否设法解决了该权限被拒绝的问题?如果是,请您更新答案吗?
    • 至少对我来说,这是一个愚蠢的错误。我正在使用不同服务帐户的凭据,该帐户没有分配 recaptcha 角色。
    猜你喜欢
    • 2022-11-11
    • 1970-01-01
    • 2022-01-19
    • 2016-10-28
    • 1970-01-01
    • 2020-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多