Google reCAPTCHA error: The provided cloud project number does not own the given recaptcha key

Google reCAPTCHA error: The provided cloud project number does not own the given recaptcha key

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

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

我有:

我正在将数据发布到此端点:

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表示密钥不匹配。当 OP 更新 client-side 密钥时,它开始工作。