Retrieve a shop's locales via GraphQL ends up in "access denied"

Solved
Tourist
5 0 0

I'm creating a Shopify App and I want to fetch the shop's locales.

 

I do the following GraphQL query on the "unstable" api version (as proposed here: https://help.shopify.com/en/api/guides/shop-locales#retrieve-a-shops-locales)

 

{
  shoShopify GraphiQL ApppLocales {
    locale
    primary
    published
  }
}

 

 

In the Shopify GraphiQL App I receive a response.

But when I do that query via my app, I receive the error message "access denied":

{#582 ▼
  +"response": Response {#594 ▼
    -reasonPhrase: "OK"
    -statusCode: 200
    -headers: array:30 [▶]
    -headerNames: array:30 [▶]
    -protocol: "1.1"
    -stream: Stream {#592 ▶}
  }
  +"body": array:1 [▼
    0 => {#597 ▼
      +"message": "access denied"
      +"locations": array:1 [▼
        0 => {#595 ▼
          +"line": 2
          +"column": 15
        }
      ]
      +"path": array:1 [▼
        0 => "shopLocales"
      ]
    }
  ]
  +"errors": true
  +"timestamps": array:2 [▼
    0 => null
    1 => 1567694602.4277
  ]
}

What should I check to find the problem?

0 Likes
Community Manager
Community Manager
618 45 81

Hi @jasperesign,

 

Does your app have read_locales scope? This error makes it seem like it does not.

1 Like
Tourist
5 0 0

Hi @Busfox ,

 

Yes I do have all permissions for my app.

 

Thanks for the tip though!

I still can't access it...

0 Likes
Community Manager
Community Manager
618 45 81

Hi again,

 

Are you sure you have read_locales permission? When I test this, I get the same error without that permission, but it works fine with that permission. If you continue to have trouble,  can you share the request-id (found in response headers) for one of the failing requests?

 

Thanks

0 Likes
Tourist
5 0 0

Hi @Busfox!

 

This is my Request ID of my latest try:

4c5afd2c-a1eb-4618-8fe2-b2cd7c66a573

 

I'm pretty sure I selected all permissions when creating the app. Though, there is no permission with locales as far as I can see...

This is the permission list of my app:

  • Modify store content like articles, blogs, comments, pages, and redirects
  • Modify theme templates and theme assets
  • Modify products, variants, and collections
  • Read product information
  • Modify customer details and customer groups
  • Modify orders, transactions, and fulfillments
  • Modify draft orders
  • Modify inventory
  • Read locations
  • Modify script tags in your store's theme template files
  • Modify fulfillment services
  • Modify shipping rates, countries, and provinces
  • Read analytics
  • Modify checkouts
  • Modify reports
  • Modify price rules
  • Modify marketing events and related marketing engagement data
  • Modify resource feedback
  • Write dynamic content translations
  • Read store content like articles, blogs, comments, pages, and redirects
  • Read theme templates and theme assets
  • Read products, variants, and collections
  • Read customer details and customer groups
  • Read orders, transactions, and fulfillments
  • Read draft orders
  • Read inventory
  • Read script tags in your store's theme template files
  • Read fulfillment services
  • Read shipping rates, countries, and provinces
  • Read checkouts
  • Read reports
  • Read price rules
  • Read marketing events and related marketing engagement data
  • Read resource feedback
  • Read dynamic content translations


How can I add a new permission? I already tried it based on this documentation, but without success: https://help.shopify.com/en/api/getting-started/authentication/oauth#step-2-ask-for-permission

0 Likes

Success.

Community Manager
Community Manager
618 45 81

Hi again,

 

Thanks for the request id! Our logs confirmed my suspicion that your app does not have read_locales scope. You would need to add that during your OAuth flow, and the merchant would need to accept giving access to locales. The link you shared is the correct doc to reference for this. Ensure your app has the proper scopes and let me know if you continue having trouble.

 

Cheers,

1 Like
Tourist
5 0 0

Thanks for your time @Busfox!
I managed to add the extra scope!

 

It's strange that I couldn't select the `read_locale` scope during the creation of my app.

0 Likes
Highlighted
Tourist
4 0 2

nice, .. but where did you find out about read_locales , it's not listed in the docs for api access scopes?

0 Likes
Tourist
5 0 0

@devkai Normally I can select that scope from the access scopes list when creating a new app.
But indeed, I didn't find a reference in the docs as well.
Thanks to @Busfox for figuring that out.

0 Likes