1 Antwort
- Neueste
- Die meisten Stimmen
- Die meisten Kommentare
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
beantwortet vor 4 Jahren
Relevanter Inhalt
- AWS OFFICIALAktualisiert vor 3 Jahren
- AWS OFFICIALAktualisiert vor einem Jahr
- AWS OFFICIALAktualisiert vor 2 Jahren
- AWS OFFICIALAktualisiert vor einem Jahr