1 Respuesta
- Más nuevo
- Más votos
- Más comentarios
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
respondido hace 4 años
Contenido relevante
- OFICIAL DE AWSActualizada hace 3 años
- OFICIAL DE AWSActualizada hace un año
- OFICIAL DE AWSActualizada hace un año