Skip to content

I have issue to add the json key file  #158

Description

@muhammadsamir11

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

Activity

  1. jmdobry commented on Jul 24, 2016

    @jmdobry
    Member

    Can you please provide more information about your setup? Did you run gcloud beta auth application-default login or are you trying to use a service account? Is your GOOGLE_APPLICATION_CREDENTIALS environment variable set to the correct value?

  2. aligajani commented on Jul 24, 2016

    @aligajani

    @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

  3. jmdobry commented on Jul 25, 2016

    @jmdobry
    Member

    @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.

  4. elibixby commented on Jul 25, 2016

    @elibixby
    Contributor

    @aligajani Just to clarify what @jmdobry is saying:

    You don't need gcloud to 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.json
    
  5. aligajani commented on Jul 27, 2016

    @aligajani

    @elibixby Do you guys have a tutorial on how to use Natural Language API via PHP?

  6. jmdobry commented on Jul 28, 2016

    @jmdobry
    Member

    Not that I know of. When it appears it will appear here: https://github.com/GoogleCloudPlatform/php-docs-samples

  7. hung101 commented on Jan 20, 2017

    @hung101

    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.

  8. hung101 commented on Jan 20, 2017

    @hung101

    I found the solution:

    putenv(GOOGLE_APPLICATION_CREDENTIALS=/[filekey].json);

    must set the environment variable

  9. informaticosgb commented on Jul 21, 2017

    @informaticosgb

    I 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);

    👍

  10. added a commit that references this issue on Nov 10, 2022
  11. 4 remaining items

  12. added a commit that references this issue on Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🚨This issue needs some love.triage meI really want to be triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions