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 Resposta
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
respondido há 6 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas