Is it possible to modify the statusCode returned by API Gateway when access is denied by a lambda authorizer?
0
A customer is migrating an API from Apigee to API Gateway. Currently their API returns 401 Unauthorized when a request is denied because the token is invalid. They want to maintain same status code when possible to avoid having to ask their partners to modify their code to handle different status code.
By default API Gateway returns a 403 Forbidden when the request is denied by the Lambda Authorizer. I know that is possible to provide custom messages based on $context. authorizer.key, but have not found a way to change the statusCode returned by API Gateway.
asked 4 years ago153 views
1 Answers
0
Accepted Answer
You can use Gateway Response to modify the status code, body, and headers of the response. Choose the 'Unauthorized' gateway response type and configure as desired.
answered 4 years ago
Relevant questions
limits with API gateway custom authorizer for number of requests
Accepted Answerasked 2 years agoAPI Gateway Timeouts from Lambda
asked 3 years agoReturn a custom header from lambda authorizer in API-gateway (HTTP api)
asked a month agoClient API throttling in API Gateway
Accepted Answerasked 2 years agoClient API Throttling in API Gateway
Accepted Answerasked 2 years agoOn an apigateway websocket is the status returned from the lambda handler?
Accepted Answerasked 3 years agoIs it possible to modify the statusCode returned by API Gateway when access is denied by a lambda authorizer?
Accepted Answerasked 4 years agoIs it possible to throw custom error message from API Gateway Lambda Authorizer
asked 2 months agoLambda Authorizer with API Key enabled on API Gateway
asked 3 months agoAPI Gateway - Gateway response - HTTP API
Accepted Answerasked a year ago