簡體   English   中英

創建評估時出現 Google reCAPTCHA Enterprise Unknown field 錯誤

[英]Google reCAPTCHA Enterprise Unknown field error when Create Assessment

我確實遵循了他們關於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 ,其中參數是 request 和給我錯誤ArgumentError: Unknown field name 'request' in initialization map entry.

創建評估的正確參數/請求可能是什么?

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

所以我通過使用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")

它解決了錯誤並回答了問題(但在此之后發生了另一個關於權限被拒絕的錯誤)。 解決后我會更新。

@bxorcloud,我能夠添加recaptcha v2,但很難使用recaptcha 企業版。 任何人都可以為 Ruby 發布相同的步驟嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM