Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

GraphQL: Access Denied when querying Orders

GraphQL: Access Denied when querying Orders

milesbasnillo
Tourist
4 0 2

Hi there, I am currently working on a practice app on a test store. I am currently querying a list of customers and displaying them with ResourceList, and my query looks like this:

const GET_CUSTOMERS = gql`
query {
  customers(first: 10) {
    edges {
      node {
        id
        displayName
        email
      }
    }
  }
}
`;

 This all works fine, however the issue arises when I try retrieving the customers' orders.

const GET_CUSTOMERS = gql`
query {
  customers(first: 10) {
    edges {
      node {
        id
        displayName
        email
        orders(first: 3, reverse: true) {
          edges {
            node {
              id
            }
          }
        }
      }
    }
  }
}
`;

I changed the query to include orders, and even though this works fine on the Shopify GraphiQL App, it always returns Access Denied when I run it on my actual app. I'm pretty sure I've set all the necessary scopes like 'read_orders' and 'write_orders', so what else could I be missing? I'd really appreciate any help.

Reply 1 (1)

user7856
Tourist
8 0 3

When did you set the scopes, if you set the scopes after authenticate then remove the app and authenticate the app again. And for getting data of customer you have to add `read_customers` scope. Thanks