Amazon web services 访问Appsync解析器中的AWS Cognito用户池属性

Amazon web services 访问Appsync解析器中的AWS Cognito用户池属性,amazon-web-services,amazon-cognito,aws-appsync,Amazon Web Services,Amazon Cognito,Aws Appsync,我想检查当前用户是否有属性集,如下所示: #if(!${context.identity.claims.get("custom:organisation")}) ... Do stuff #end 我尝试了以下方法: #if (${context.identity.claims["custom:organisation"]}) #if (${context.identity["custom:organisation"]}) #if ($context.identity.claims["cu

我想检查当前用户是否有属性集,如下所示:

#if(!${context.identity.claims.get("custom:organisation")})

... Do stuff

#end
我尝试了以下方法:

#if (${context.identity.claims["custom:organisation"]})
#if (${context.identity["custom:organisation"]})
#if ($context.identity.claims["custom:organisation"])
#if ($util.isNull($context.identity.claims["custom:organisation"]))

您应该能够在索赔地图上使用containsKey,如下所示:

#if($context.identity.claims.containsKey("custom:organisation"))

... Do stuff

#end

很抱歉没有回复你。你说得对。我的问题是,执行查询的用户没有身份属性的访问权限。我必须编写一个Lambda函数来获取用户属性。