Repository navigation
I have issue to add the json key file #158
Description
Activity
Can you please provide more information about your setup? Did you run
gcloud beta auth application-default loginor are you trying to use a service account? Is yourGOOGLE_APPLICATION_CREDENTIALSenvironment variable set to the correct value?@jmdobry Hey man, I am a bit confused. Do I have to use gcloud to use the natural language API, because it seems like an over kill. Can't I just supply the API key or the service account .json file and be ready to make calls from my PHP app using Guzzle. I haven't seen any API endpoint being accessed in such a non-trivial way, such that it makes beginner trials boring and tedious
Reacted by Marc de Ruijter, shrutirajagopal and Jimmy McCabe@aligajani You are not required to use Google client libraries in order to communicate with Google APIs, but it is useful if you don't have time to implement your own client library.
If you're struggling to deploy one of the Node.js samples in this repository, then opening an issue here is good way to get help, only you must provide enough information for me to be able to reproduce the error before I can help you, e.g. which sample you're trying to deploy, stack trace, app.yaml, package.json, Node version, etc.
If you're looking for free general support, you can hop onto our Slack channels and post your question (there's even a php channel), or search Stack Overflow. Here are some more links to Google Cloud Platform developer communities.
If you're looking for paid technical support, you can find that on cloud.google.com/support.
@aligajani Just to clarify what @jmdobry is saying:
You don't need
gcloudto use Google APIs. In this case you can just point to a service account json file:export GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/service_account.jsonReacted by Timo Kleemann@elibixby Do you guys have a tutorial on how to use Natural Language API via PHP?
Not that I know of. When it appears it will appear here: https://github.com/GoogleCloudPlatform/php-docs-samples
i followed instructions from https://github.com/GoogleCloudPlatform/php-docs-samples having the same issue, by just passing projectid, it prompt this Error: Could not load the default credentials. Browse to https://developers.google.com/accounts/docs/application-default-credentials for more information.
I found the solution:
putenv(GOOGLE_APPLICATION_CREDENTIALS=/[filekey].json);must set the environment variable
Reacted by Jason Dobry, Rashedul Islam Sagor, Aurélie Leportier, Nisar Khalid and Rajneesh MitharwalI solved it:
putenv('GOOGLE_APPLICATION_CREDENTIALS=../service-account.json');
$client = new Google_Client();
$client->useApplicationDefaultCredentials();
$client->setScopes(['https://www.googleapis.com/auth/analytics.readonly']);
$client->refreshTokenWithAssertion();
$token = $client->getAccessToken();
$accessToken = $token['access_token'];
dd($accessToken);👍
Reacted by Paul Makhnovskiy- added🚨This issue needs some love.This issue needs some love.triage meI really want to be triaged.I really want to be triaged.
on Apr 6, 2020 - added a commit that references this issue
on Nov 8, 2022 - added a commit that references this issue
on Nov 10, 2022 - added a commit that references this issue
on Nov 10, 2022 4 remaining items
- added 2 commits that reference this issue
on Nov 15, 2022 - added a commit that references this issue
on Nov 17, 2022 - added 2 commits that reference this issue
on Nov 18, 2022 - added a commit that references this issue
on Jan 11, 2023
Error: Could not load the default credentials. Browse to https://developers.google.com/accounts/docs/application-default-credentials for more information.
can you help me how can i fix that