I am building an application that requires me to know which user sent the API request. The requesting user determines which data that is sent back in the response.
I am using Cognito to authenticate users, as well as for API authorization. When a user sends a request to API Gateway using Cognito Authorization, the user’s Cognito Sub ID is included within event.requestContext. So, if I want the Cognito ID of the user I look at event.requestContext.authorizer.claims.sub.
Is there is a way to mimic this within the requestContext so that I can test locally, without having to deploy to AWS?