Reputation: 1401
Creating a mobile app using aws mobile hub, which uses google authentication. After authentication is done, it calls the api gateway and gateway calls the lambda function. Need to extract the logged in user's email, either in gateway or lamda function for some custom logic. Lambda is written in java.
Upvotes: 1
Views: 322
Reputation: 81336
The information that you want is (not always) present in the JWT token. Depends on how the Identity Provider (Google, Facebook, etc) is setup. If the email address is not in the JWT token than you cannot access it. Some Identity Providers can control the level of information that you can access.
Review this article for more information:
Introducing custom authorizers in Amazon API Gateway
Upvotes: 1
Reputation: 16037
It's difficult to give a specific answer without knowing how your API Gateway-Lambda integration is configured.
The information from Cognito should be available to you via event.requestContext.identity
(unless your API Gateway mapping template changed it). You might still need to use the Cognito library to retrieve additional information.
Upvotes: 0