Graphql 放大图形QL仅列出当前用户待办事项';s

Graphql 放大图形QL仅列出当前用户待办事项';s,graphql,aws-amplify,Graphql,Aws Amplify,有一个schema.graphql,如下所示: type Todo @model @auth(rules: [ { allow: owner, operations: [create, read, update, delete], identityClaim: "sub" } ]) { id: ID! name: String! description: String owner: String } 我在测试应用程序中使用了cognito for

有一个schema.graphql,如下所示:

type Todo @model @auth(rules: [
  {
    allow: owner,
    operations: [create, read, update, delete],
    identityClaim: "sub"
  }
]) {
  id: ID!
  name: String!
  description: String
  owner: String
}
我在测试应用程序中使用了cognito for athentication。我可以创建用户,作为其中一个用户登录,等等

doeas@auth指令到底是什么?使用listTodos查询时:

const todoData = await API.graphql(graphqlOperation(listTodos));
我只想从服务器上拿回我的待办事项,但我都拿到了。很明显我遗漏了什么

我的意思是,如果我查看我的表数据,那么owner字段将正确地使用我的用户ID进行填充


我如何完成我的用例?仅列出我的项目

您是否需要将identityProvider设置为“oidc”才能使用identityClaim“sub”?我尝试不使用它,但结果相同这里有一个示例: