-1

My issue is simply that I want to be able to use google talents solutions API, create a mock couple of jobs and companies and use them to perform dummy searches on. I'm using PHP which is also very new to me and can't at the moment use anything else for implementation unless it works with PHP. My code for creating a company for instance works fine hardcoded in PHP, and returns a success message, but if I want to use a html/php form to do it. I get the following error on form submit:

Fatal error: Uncaught DomainException: Could not load the default credentials. Browse to https://developers.google.com/accounts/docs/application-default-credentials for more information in /Users/shaun/Sites/gts/vendor/google/auth/src/ApplicationDefaultCredentials.php:168

Stack trace:

#0 /Users/shaun/Sites/gts/vendor/google/gax/src/CredentialsWrapper.php(197): Google\Auth\ApplicationDefaultCredentials::getCredentials(Array, Object(Google\Auth\HttpHandler\Guzzle6HttpHandler), NULL, NULL)

#1 /Users/shaun/Sites/gts/vendor/google/gax/src/CredentialsWrapper.php(114): Google\ApiCore\CredentialsWrapper::buildApplicationDefaultCredentials(Array, Object(Google\Auth\HttpHandler\Guzzle6HttpHandler))

#2 /Users/shaun/Sites/gts/vendor/google/gax/src/GapicClientTrait.php(339): Google\ApiCore\CredentialsWrapper::build(Array)

#3 /Users/shaun/Sites/gts/vendor/google/gax/src/GapicClientTrait.php(321): Google\Cloud\Talent\V4beta1\Gapic\CompanyServiceGapicClient->createCredentialsWrapper(NULL, Array)

#4 /Users/shaun/Sites/gts/vendor/google/cl in /Users/shaun/Sites/gts/vendor/google/gax/src/CredentialsWrapper.php on line 200

Any help on how I can enable the credentials would be much appreciated. I have tried export credentials to relative .json on terminal and coding in a global variable in the php. So far no luck, although maybe I'm doing it wrong.

I have also authorized the domain 'lvh.me'.

Community
  • 1
  • 1
Shaun
  • 101
  • 1
  • 7
  • 2
    I didn't downvote your question, but I'd guess it's because it looks like you didn't read [ask] and you certainly didn't provide a [mcve]. At this point people can only guess what you're doing and what could be going wrong. Your question could also be seen as "here's my error dump, fix it for me". Many people feel this is a waste of everybody's time. You could add a [mcve] and mention what you found on the link in the error message and how it did or did not help you. IMHO that would improve your question and increase the chance for an answer. Good luck! – Robert Nov 14 '19 at 15:52
  • As @Robert mentioned, try providing more information on what you are doing and how you are doing it, so you can get more helpful information. Regarding the issue, take a look at [this question](https://stackoverflow.com/a/51654387/7517757) where is discussed the credentials in PHP – Tlaquetzal Nov 19 '19 at 16:28
  • Thanks, appreciate the comments from @Robert and will take it onboard. Issue now resolved. – Shaun Nov 20 '19 at 17:07
  • @Shaun Welcome to SO! If your issue was resolved, you should answer your own question and then accept that answer, rather than editing your post. It is actually encouraged to [self-answer](https://stackoverflow.com/help/self-answer) – robsiemb Nov 26 '19 at 01:01
  • @rosiemb Thank you Rosie, I will do so! – Shaun Dec 13 '19 at 09:13

1 Answers1

1

Issue resolved, was not using putenv() variable like so:

putenv("GOOGLE_APPLICATION_CREDENTIALS=" . $GOOGLE_APPLICATION_CREDENTIALS);

Shaun
  • 101
  • 1
  • 7