Reputation: 748
How to specify all Cognito users can access custom lambda resolver
type Query {
tasks: [Task] @function(name: "lambda1-${env}")
getTask(id:ID!): Task @function(name: "lambda1-${env}")
}
type Task {
id: ID!
name: String!
}
I am getting unauthorized when doing
const taskList = await API.graphql({
query: tasks,
authMode: 'AMAZON_COGNITO_USER_POOLS'
});
Upvotes: 0
Views: 425
Reputation: 748
Finally got it working.
type Query {
tasks: [Task] @function(name: "lambda1-${env}") @auth(rules: [{ allow: private, provider: userPools }])
getTask(id:ID!): Task @function(name: "lambda1-${env}")
}
type Task {
id: ID! @auth(rules: [{ allow: private, provider: userPools }])
name: String! @auth(rules: [{ allow: private, provider: userPools }])
}
const taskList = await API.graphql({
query: tasks,
authMode: 'AMAZON_COGNITO_USER_POOLS'
});
Upvotes: 2