ruby-on-railsgoogle-cloud-platformrecaptcha-v3recaptcha-enterprise

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


I'm trying to use google ReCaptcha enterprise in my rails project, but I'm getting this error:

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

What I have:

I'm posting data to this endpoint:

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

and the body of the request is:

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

Solution

  • As OP confirmed in the comment section, the root cause of the issue was with wrong 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

    Error The provided cloud project number does not own the given recaptcha key indicates that there is a mismatch with the key. When OP updated the client-side key it started to work.