I am building a public App, and wanted to get the list of all cutomers in my Development Store. But I am not able to render the list
import React from 'react' import gql from 'graphql-tag' import { Query } from 'react-apollo' const GET_CUSTOMERS = gql` query getCustomers { customers { edges { node { displayName totalSpent } } } } ` class Customers extends React.Component { render() { return ( <Query query={GET_CUSTOMERS}> {({ data, loading, error }) => { if (loading) { return <div>Loading…</div>; } if (error) { return <div>{error.message}</div>; } { return data.customers.edges.map((edge) => ( <p key={edge.node.displayName}> {edge.node.displayName}</p> ))} }} </Query> ) } } export default Customers
I am getting `GraphQL error: access denied` . Can you help please.
Are you sure your app's token has the read_customers access scope and is correctly passed along? If you try the request from postman or curl, do you get the error?
When you first register your app in the Shopify store, the URL that pops up the "allow" form should list all the scopes your app is allowed access to. See https://help.shopify.com/en/api/getting-started/authentication/oauth/scopes for details!
Heyy Visely.. I am also getting same error of access denied for 'customers', I have given the permission of read_customers and write_customers to my api.. infact it is working fine while querying for a customer with accesstoken but it is not working while I am trying to fetch the list of all customers with the 'customers' queryroot.. For 'customers' queryroot, I am getting the accesssdenied error in online graphql editor.. while in Postman I am getting "Field 'customers' does not exist on 'queryroot'"
User | Count |
---|---|
13 | |
12 | |
7 | |
6 | |
5 |