[英]aws api gateway enable api_key for authentication
I have added api_key to my rest api in aws api gateway for authenticating a GET request method.我已将 api_key 添加到 aws api 网关中的其余 api 以验证 GET 请求方法。
My request is:我的要求是:
curl -X GET -H "x-amz-key: XXXXXXXXXXXXXXXXXXXXXXQklq4C7vbEGprA" "https://XXXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com/test/10/12/+"
I keep getting the following error:我不断收到以下错误:
{"message": "Forbidden"}
I am doing everything as the AWS docs mention.我正在做 AWS 文档中提到的所有事情。 Can anybody point me to the right direction here, how to add api_key in request?
任何人都可以在这里指出正确的方向,如何在请求中添加 api_key?
The same request works fine if api_key authentication is removed.如果删除 api_key 身份验证,则相同的请求可以正常工作。
The name of the attribute is x-api-key
not x-amz-key
属性的名称是
x-api-key
而不是x-amz-key
Callers must now add to each call a custom header named x-api-key, along with the value of the API key.
调用者现在必须向每个调用添加一个名为 x-api-key 的自定义标头,以及 API 密钥的值。 For example, if the API key value is bkayZOMvuy8aZOhIgxq94K9Oe7Y70Hw55 , the custom header would be as follows:
例如,如果 API 密钥值为bkayZOMvuy8aZOhIgxq94K9Oe7Y70Hw55 ,则自定义标头如下:
x-api-key: bkayZOMvuy8aZOhIgxq94K9Oe7Y70Hw55
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.