James
James

Reputation: 1

How to custom client request in AWS API Gateway + Lambda(JWT Auth)

aws structure picture

JWT authorization (verify) is in progress in AWS Lambda.

I want to put the decoded data into the client request headers. Becuase, I don't want to decode the token again at the 'service' and use it.

How to custom the client request?

AWS lambda 'event.headers' is undefined. so, 'event.headers.user' is not possible.

Is there any other good way?

Upvotes: 0

Views: 301

Answers (1)

Lucasz
Lucasz

Reputation: 1228

You don't adjust the request you need to adjust the event that is being send to the lambda from the authoriz.

You can use the context of the authorizer. The context can be accessed in the lambda that is handling the request.

context.authorizer.property

https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html

Upvotes: 1

Related Questions