例如对于这个查询:
https://www.googleapis.com/container/v1beta1/projects/PROJECT_ID/clusters
如前所述
获得 API 密钥后,您的应用程序可以将查询参数 key=yourAPIKey 附加到所有请求 URL。
我将它添加到网址:
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"
}
}
我什至尝试将密钥添加到标题的授权部分......并且出现了这个错误:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
问题出在哪里?还是我做错了什么?