如何在 HttpApi of AWS 的 http 代理集成中使用 cognito:username ?



我想使用名为 event.requestContext.authorizer.jwt.claims.cognito:username 的变量,它是 JWT 授权方在 AWS 的 HttpApi(我的意思是不是 RestApi(的 http 代理集成的 URI 上的结果,因为我想访问授权用户的信息。公开的 api 是这样的。

https://xxxxxx.com/platform/pro/user/john

亲意味着生产. john is event.requestContext.authorizer.jwt.claims.cognito:username .

管理控制台说我这样的输入是错误的。 https://xxxxxx.com/platform/${stageVariables.stage}/user/${event.requestContext.authorizer.jwt.claims.cognito:username}

我认为:是NG。

请帮助我。

我只是偶然发现了这个问题。我想您在此期间解决了这个问题,但是如果它仍然相关,您需要将cognito:username放在引号和括号中,因此${event.requestContext.authorizer.jwt.claims.cognito:username}使用${event.requestContext.authorizer.jwt.claims['cognito:username']}而不是使用.

最新更新