GOOGLE_APPLICATION_CREDENTIALS error

前端 未结 3 818
别那么骄傲
别那么骄傲 2021-02-03 11:33

I am trying to use the google speech API for converting an audio file to text, but facing some problems with the documentation.I have enabled the speech API and created an servi

相关标签:
3条回答
  • 2021-02-03 12:28

    you can generate your key json file on gcloud using this command: gcloud auth application-default login

    google will display a link to confirm, once you do, there will be the json file ina temp folder displayed

    0 讨论(0)
  • 2021-02-03 12:33

    gcloud credentials and and application default credentials are managed separately. If you activated service account key file this only can be used for gcloud commands but not for application default credentials.

    gcloud auth application-default set of commands are there only to manage application default and having nothing to do with commands in gcloud auth.

    There a few ways to "activate" application default credentials:

    • Use your user account
      • Run gcloud auth application-default login, or
    • Use service account (preferred)

      • set environment variable GOOGLE_APPLICATION_CREDENTIALS=path/to/your/service_accont_key_file.json
      • copy path/to/your/service_accont_key_file.json to ~/.config/gcloud/application_default_credentials.json`

        • On windows this might be different, run

          gcloud info --format="value(config.paths.global_config_dir)"
          

          to get a path to your config directory.

    now command like

    gcloud auth application-default print-access-token
    

    should work.

    0 讨论(0)
  • 2021-02-03 12:36

    As A solution you can Download the GCLOUD console and then RUN this command on console "gcloud auth application-default" login with the gmail account which have the project access and then you will get access of google api which are enabled.

    0 讨论(0)
提交回复
热议问题