0

I'm using Google reCAPTCHA Enterprise, and I'm on the stage of creating an "assessment" in my server side code (PHP). I'm following the example code from the docs but I get an error:

"Google\ApiCore\ValidationException - Could not construct ApplicationDefaultCredentials"

from the line

$client = new RecaptchaEnterpriseServiceClient();

I found this question which talks about some credentials in a JSON file, but I don't see any information anywhere about what the JSON file is supposed to be. It doesn't really make sense to me because the sitekey and token are passed in a couple lines later anyway:

$event = (new Event())->setSiteKey($recaptchaKey)->setToken($token);

In the RecaptchaEnterpriseServiceClient it appears to take an $options array, is there some way to just pass in the "credentials", whatever they are?

President Jam
1,3141 gold badge6 silver badges22 bronze badges
asked Oct 8, 2025 at 13:19
1
  • 1
    See this documentation overview page that describes the steps and references AUTHENTICATION. You very likely want tto use Application Default Credentials to authenticate to Google Cloud services. I'm unfamiliar with reCAPTCHA but a quick read of the docs suggests that reCAPTCHA keys and tokens are specific to the service's implementation. Commented Oct 8, 2025 at 17:22

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.