I am using a Cognito user pool with user groups and I have an AWS API Gateway with a custom authorizer. The authorizer can generate a valid IAM policy and things go well so far. I would like to generate more specific IAM policies based on user groups but I cannot get the user groups information in the authorizer. My integration request mappings are:
"groups" : "$context.authorizer.claims['cognito:groups']"
but in the authorizer I get
"type": "TOKEN",
"authorizationToken": "...",
"methodArn": "arn:aws:execute-api:eu-west-1:...:.../test/GET/bills"
How can I get the user groups attribute in the authorizer?