Reputation: 722
I'm using AWS API Gateway. Now any route is marked with API Key Required
.
To get this key, I created Usage Plan and added key to it in API Keys
tab.
Now I have key, which I substitute in GET request using ?x-api-key=my_key
, but I still get {"message": "Forbidden"}
What could be the problem?
(If I remove API Key Required
from routes, my views are shown correctly)
Upvotes: 1
Views: 210
Reputation: 35258
There is currently no support for passing in the API key as a query string.
Your API Gateway API can receive API keys from one of two sources:
HEADER
You distribute API keys to your customers and require them to pass the API key as the X-API-Key header of each incoming request.
AUTHORIZER
You have a Lambda authorizer return the API key as part of the authorization response. For more information on the authorization response, see Output from an Amazon API Gateway Lambda authorizer.
Instead it should be added as a header of x-api-key
.
More information is available here to explain how to use this with your REST API.
Upvotes: 1