Query String Parameters in Custom Lambda Authorizer

0

I really can't get this to work. I have a websocket API on the API Gateway. On the connect route, I have a Lambda authorizer. When I look for a header variable on the authorizer,

Lambda Event Payload: Request Identity Sources: authorizer (header)

It comes through fine and is there to pick up in the Lambda function:

var token = event.headers.authorization;

If I switch to a query string source:

Lambda Event Payload: Request Identity Sources: authorizer (querystring)

It logs:

(OfuuwFZELPEF_IA=) Incoming identity: {method.request.querystring.authorization=******************************D028A8}

But there is nothing to collect in the Lambda function: event.queryParameters is undefined.

Any solutions greatly appreciated.

1 Answer
0

You may be referencing an incorrect field in your Lambda function. A typical REQUEST event will have the field event.queryStringParameters, not event.queryParameters. This page provides an example of the REQUEST structure: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-input.html .

AWS
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions