我正在尝试了解当用户进行经过身份验证的请求时,我能够从API网关访问的可用声明是什么 .

API网关映射模板参考(https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#context-variable-reference)列出了不同的授权者声明,但它看起来只有"sub"和"email"工作 .

所有其他声明都记录为“ - ”

我正在使用CloudWatch记录请求,如本指南中所述:https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html

我也想获得用户名,但以下映射都不起作用:

  • $ context.authorizer.claims ['cognito:username']

  • $ context.authorizer.claims \ ['cognito:username' ]

  • $ context.identity.cognitoIdentityId