1 Answer
- Newest
- Most votes
- Most comments
0
I found out: I had to check the "Lambda proxy integration" checkbox in the Integration request of the method.
Then the Lambda can fetch the user info from the event object of the lambda handler (e.g. in Python):
event['requestContext']['authorizer']['claims']['cognito:groups']
(or: 'cognito:username', etc.)
Then I could query different databases according to which group the user belongs to.
Additional info: it is also possible to assume the user role from within the Lambda function, to make sure to access only what's the user is allowed to (by default only the Lambda function's role is assumed to execute actions); this is very well explained at https://www.youtube.com/watch?v=GDkkDUnICrs
answered 4 years ago
Relevant content
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 3 years ago