本文介绍了Google Container Engine REST API授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此处所述,我创建了使用.

As mentioned here I created API key for using cluster operations.

例如此查询:

https://www.googleapis.com/container/v1beta1/projects/PROJECT_ID/clusters

并且如上所述

我将其添加到了网址:

https://www.googleapis.com/container/v1beta1/projects/PROJECT_ID/clusters?key = my_key

但是我有错误:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "required",
    "message": "Login Required",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Login Required"
 }
}

我什至试图将密钥添加到标头的Authorization部分...并出现以下错误:

I even tried to add key to Authorization part of header...and had this error:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "authError",
    "message": "Invalid Credentials",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Invalid Credentials"
 }
}

哪里有问题?还是我出了什么问题?

Where is problem? Or did i something wrong?

推荐答案

根据有关API密钥的Google帮助文档(强调):

此外,它表示可以将它们用于访问Google服务公开或拥有的数据. Google容器群集(GKE)数据都不是.我不确定文档为什么建议使用API​​密钥,但是我知道OAuth可以工作,因此,如果可以使用OAuth,则应该可以使REST API正常工作.

Furthermore, it says that they can be used to access data that is public or owned by a Google service. The Google Container Clusters (GKE) data is neither of these. I'm not sure why the documentation suggests using an API key, but I know that OAuth works so if you can use that instead you should be able to get the REST API working.

这篇关于Google Container Engine REST API授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-01 11:37