ruby-on-rails - 谷歌验证码错误 : The provided cloud project number does not own the given recaptcha key

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

我正在尝试在我的 Rails 项目中使用 google ReCaptcha enterprise,但出现此错误:

{"error"=>{"code"=>403, "message"=>"The provided cloud project number does not own the given recaptcha key", "status"=>"PERMISSION_DENIED"}}

我有什么:

  • 我的项目ID,我是从ID栏下的项目列表中得到的
  • reCAPTCHA key (站点 key )和在 reCAPTCHA Enterprise 面板中创建的域
  • 已创建 API key here .应用程序限制:无,API 限制:reCAPTCHA Enterprise API

我正在向此端点发布数据:

https://recaptchaenterprise.googleapis.com/v1beta1/projects/#{project_id}/assessments?key=#{API_key}

请求的正文是:

{
    event:
    {
        token: response_token,
        siteKey: site_key,
        userIpAddress: domain
    }
}

最佳答案

正如 OP 在评论部分确认的那样,问题的根本原因是错误的 enterprise key

You're right, I was using the v3 site key on the client-side, which means the response_token was wrong. I forgot to update the client-side by enterprise key. thanks man, it works now

错误 The provided cloud project number does not own the given recaptcha key 表示与 key 不匹配。当 OP 更新 client-side key 时,它开始工作。

关于ruby-on-rails - 谷歌验证码错误 : The provided cloud project number does not own the given recaptcha key,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70241961/

相关文章:

验证码 V3 : Do we need to verify token for each page?

ruby-on-rails - Rspec 在 "let"s 上失败

google-cloud-platform - 在同一个Google云端项目中添加多个git存储库的可能方法

ruby-on-rails - 在 Ruby 中传递&符号冒号与仅冒号(符号)之间的区别

python - 适用于 Mac 的 Gcloud sdk 安装

google-cloud-platform - Apache Phoenix - GCP 数据处理

laravel - 在 Laravel 5.7 中使用 Google reCaptcha v3

recaptcha - 谷歌 reCAPTCHA 在中国

ruby-on-rails - Rails + SendGrid 不允许未经身份验证的发件人

ruby-on-rails - 从 Rails 6 中删除 ActiveStorage 路由