Google cloud platform 如何在头中定义API键而不是在查询中
我一直在使用我的API密钥作为查询参数。但我不喜欢我的API密钥在web浏览器中保持记忆。因此,我希望将其传递到标头中,而不是作为查询参数。下面是我的yaml文件,它是我从CloudEndpoints文档中获得的Google cloud platform 如何在头中定义API键而不是在查询中,google-cloud-platform,google-cloud-endpoints,openapi,api-key,Google Cloud Platform,Google Cloud Endpoints,Openapi,Api Key,我一直在使用我的API密钥作为查询参数。但我不喜欢我的API密钥在web浏览器中保持记忆。因此,我希望将其传递到标头中,而不是作为查询参数。下面是我的yaml文件,它是我从CloudEndpoints文档中获得的 security: - api_key: [] securityDefinitions: api_key: type: apiKey name: key in: query 当我在:query中将更改为in:header时,它似乎不起作用。因为,我仍
security:
- api_key: []
securityDefinitions:
api_key:
type: apiKey
name: key
in: query
当我在:query中将更改为in:header
时,它似乎不起作用。因为,我仍然可以使用API键作为查询参数来调用我的API。另外,当我检查开发人员门户时,请尝试此API,因为所有使用API键的端点都已禁用。除了将:query
中的更改为中的:header
之外,我想不出任何其他方法,这是行不通的。我做错了什么?还有,如何在标头中指定API密钥
谢谢大家! 你没有做错什么。使用云端点是不可能的。就这些。你没有做错什么。使用云端点是不可能的。就这些