GraphQL: Access Denied when querying Orders

Highlighted
Tourist
4 0 1

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.

1 Like
Highlighted
New Member
7 0 0

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

0 Likes