4
votes

I have a question about API Gateway authorizers and lambda functions.

My scenario is the following: I have a resource in AWS API Gateway for which the authorization is enabled. The authorizer calls a lambda function which, if the user is not authorized, redirects the user to another URL.

So basically I would like to customize the authorizer to return a 302 rather than a 401/403/500 status code. Do you know if that is possible?

I know that having a lambda function in the integration phase of the gateway lets me customize the response. What about this particular scenario?

Thanks.

1

1 Answers

0
votes

A Custom API Gateway Authorizer returns an IAM Policy to API Gateway allowing or denying access to resources.

Custom API Gateway Authorizer

You can customize the response when the client tries to get a token (login), but in the authorization flow the API Gateway calls the Lambda function, supplying the authorization token extracted from a specified request header, then the lambda function returns an IAM Policy.