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:
- My project ID, I got from the list of the project under the ID column
- reCAPTCHA Key (site key) and domains created in reCAPTCHA Enterprise panel
- An API Key created here. Application restrictions: none, API restrictions: reCAPTCHA Enterprise API
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
}
}
CodePudding user response:
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.