I am trying to get a custom response from lambda authorizer for API gateway (HTTP API). Apart from checking cognito token we have added custom validations and expect to add the reason for the failure in the response. We have added error response in context but couldn't find a way to add it in the response. We just get "403 Forbidden" message. Does anyone have any solution for this?
Asked
Active
Viewed 652 times
4
-
I'm wondering the exact same thing! – Jean-Baptiste Martin May 18 '21 at 09:14
-
Isn't this what you're looking for? https://stackoverflow.com/a/49806967/5493813 – st.huber Oct 01 '21 at 06:44
-
@st.huber that is for REST API not HTTP. – oldBear Jun 09 '22 at 12:46
-
@oldBear From the linked answer you can get the gists of how to return different responses from an authorization Lambda. You cannot freely define any response but you can specify whether the return should be a 200, 401, 403 or 500 response, with a custom message (not the format of the response body) – st.huber Jun 09 '22 at 13:03
-
AFAIK that only works for APIGW v1(REST API) not v2 (HTTP API). Haven't tested it so can't say if it works or not. – oldBear Jun 10 '22 at 08:11