I have a Method that is using a Cognito User Pools Authorizer. I'm wanting to grab the principal Id from the context and pass to the integration endpoint via a custom header. I've tried context.authorizer.principalId which yields nothing. i.e the header doesn't show. If I set to a 'hardCodedString' it will show. Other context options like appId are working, seems specific to Cognito.

Essentially I'm attempting to have API Gateway handle the token validation part of the work.

1 Answers

Jim Hankins On Best Solutions

Resolved via using header attribute in integration like:

context.authorizer.claims.email and context.authorizer.claims.sub

within the Method's Integration Request settings of API Gateway.