How can I grab a URL parameter from a response using AWS API Gateway?

86 Views Asked by At

I am trying to use AWS API Gateway to call an external API endpoint in order to perform an oauth2 handshake.

The remote API responds to a GET request with a URL with a code parameter in the URL.

I would like to be able to grab that code parameter content in order to use it for the second part of the handshake, but I don't see a way to get the content in the Integration Response method of AWS API Gateway.

Any tip in the right direction will be appreciated

1

There are 1 best solutions below

0
On BEST ANSWER

Use API Gateway. If you'd like, you can get very detailed about what parameters are accepted, how they are parsed and in turn passed to Lambda, but at its simplest, you can define your resource method to simply 'proxy' the request for Lambda by selecting Use Lambda Proxy integration at the Integration Request portion of the method definition.

With this configuration, the Lambda function receives the entire request, query parameters and all, in the event object. Query parameters can be accessed in the queryStringParameters attribute.