# How to retrieve user id when using AWS Cognito and Api Gateway?

**URL:** <https://community.auth0.com/t/how-to-retrieve-user-id-when-using-aws-cognito-and-api-gateway/7298>\
**Category:** Get Help\
**Tags:** aws, lambda, integrations, cognito, auth0\
**Created:** [June 28, 2017, 8:07am UTC](https://community.auth0.com/t/how-to-retrieve-user-id-when-using-aws-cognito-and-api-gateway/7298 "2017-06-28T08:07:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathan1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@nathan1](https://community.auth0.com/u/nathan1)\
**Post date:** [June 28, 2017, 8:07am UTC](https://community.auth0.com/t/how-to-retrieve-user-id-when-using-aws-cognito-and-api-gateway/7298/1 "2017-06-28T08:07:17Z")

</div>

We've been following the [AWS Cognito Tutorial](https://auth0.com/docs/scenarios/amazon-cognito) and authentication is working fine. We're able to invoke a Lambda function via the API Gateway after authentication. However, we now want to retrieve the user id / email (or alternatively the JWT token) in Lambda. How would we go about this?

I also read the [Api Gateway integration documentation](https://auth0.com/docs/integrations/aws-api-gateway/). However, if I understand correctly, this is an alternative to Cognito to retrieve the API Key, right? We don't want to replace Cognito...

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:55am UTC](https://community.auth0.com/t/how-to-retrieve-user-id-when-using-aws-cognito-and-api-gateway/7298/2 "2018-03-02T05:55:01Z")

</div>


