Google Sheets API returns “The caller does not have permission” when using server key

后端 未结 5 1193
青春惊慌失措
青春惊慌失措 2020-12-01 03:56

I\'ve generated a server key in the API Manager and attempted to execute the following on my Mac:

curl \'https://sheets.googleapis.com/v4/spreadsheets/MyShee         


        
5条回答
  •  既然无缘
    2020-12-01 04:27

    The easiest way is to fix using gcloud cli. More docs here https://cloud.google.com/pubsub/docs/quickstart-cli#before-you-begin

    install gcloud

    sudo apt-get install google-cloud-sdk
    

    then call

    gcloud init
    

    then check your active project and credentials

    gcloud config configurations list
    

    If it is not ok, make sure you are authenticated with the correct account:

    gcloud auth list
    * account 1
      account 2
    

    Change to the project's account if not:

    gcloud config set account `ACCOUNT`
    

    Depending on the account, the project list will be different:

    gcloud projects list
    
    - project 1
    - project 2...
    

    Switch to intended project:

    gcloud config set project `PROJECT NAME`
    

    Then Create Application Default Credentials with gcloud auth application-default login, and then google-cloud will automatically detect such credentials.

提交回复
热议问题