I am building and testing Lambda functions on my local pc. The Lambda's are exposed through SAM using the "sam local start-api" command and called through Javascript. I have now set up a user pool on AWS Cognito (in the cloud). My app is correctly authenticating against the user pool. However, I would like now to pass user information to my Lambdas when I invoke them on my local pc. What I want to achieve is:
- My JS web app sends a request with authorization header to my locally hosted Lambdas.
- My Lambda accesses the claims through $context.authorizer.claims
And most importantely: The Lambda code should not be specific to my dev environment. I should be able to deploy my Lambdas to the cloud without changing the code.
Question: Is it possible to provide/inject the user claims into the context of a Lambda request on my local dev environment?