【发布时间】:2020-03-08 06:29:03
【问题描述】:
我的问题只是我希望能够使用谷歌人才解决方案 API,创建一对模拟的工作和公司,并使用它们来执行虚拟搜索。我正在使用 PHP,这对我来说也很新,目前不能使用其他任何东西来实现,除非它与 PHP 一起使用。例如,我用于创建公司的代码在 PHP 中可以很好地硬编码,并返回成功消息,但如果我想使用 html/php 表单来执行此操作。我在提交表单时收到以下错误:
致命错误:未捕获的 DomainException:无法加载默认凭据。在 /Users/shaun/Sites/gts/vendor/google/auth/src/ApplicationDefaultCredentials.php:168 中浏览至 https://developers.google.com/accounts/docs/application-default-credentials 以获取更多信息
堆栈跟踪:
#0 /Users/shaun/Sites/gts/vendor/google/gax/src/CredentialsWrapper.php(197): Google\Auth\ApplicationDefaultCredentials::getCredentials(Array, Object(Google\Auth\HttpHandler\Guzzle6HttpHandler) , 空, 空)
#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 在 /Users/shaun/Sites/gts/vendor/google/gax/src/CredentialsWrapper.php 第 200 行
任何有关如何启用凭据的帮助将不胜感激。我已经尝试将凭据导出到终端上的相对 .json 并在 php 中的全局变量中进行编码。到目前为止没有运气,虽然也许我做错了。
我还授权了域“lvh.me”。
【问题讨论】:
-
我没有否决您的问题,但我猜这是因为您似乎没有阅读How to Ask,而且您当然没有提供minimal reproducible example。在这一点上,人们只能猜测你在做什么以及可能出了什么问题。您的问题也可以被视为“这是我的错误转储,为我修复它”。很多人觉得这是在浪费大家的时间。您可以添加minimal reproducible example 并提及您在错误消息中的链接上找到的内容以及它对您的帮助或没有帮助。恕我直言,这将改善您的问题并增加答案的机会。祝你好运!
-
正如@Robert 提到的,尝试提供更多关于你在做什么以及如何做的信息,这样你就可以获得更多有用的信息。关于这个问题,请查看this question,其中讨论了 PHP 中的凭据
-
谢谢,感谢来自@Robert 的 cmets,并将带上它。问题现已解决。
-
@Shaun 欢迎来到 SO!如果您的问题得到解决,您应该回答自己的问题,然后接受该答案,而不是编辑您的帖子。其实鼓励self-answer
-
@rosiemb 谢谢罗西,我会这样做的!
标签: php google-cloud-platform google-cloud-talent-solution