Hi I am trying to fetch the metafields for a particular product from admin API but failing to do so
{
product(id: "gid://shopify/Product/6781936599084") {
metafield(namespace: "reviews", key: "review1") {
value
key
id
}
}
}
it is giving me error
{
"data": {
"product": null
},
"errors": [
{
"message": "Access denied for product field. Required access: `read_products` access scope.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"product"
],
"extensions": {
"code": "ACCESS_DENIED",
"documentation": "https://shopify.dev/api/usage/access-scopes",
"requiredAccess": "`read_products` access scope."
}
}
],
"extensions": {
"cost": {
"requestedQueryCost": 2,
"actualQueryCost": 1,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 941,
"restoreRate": 50
}
}
}
}
I have also given access to read and write products
and when I am running the same query from storefront api it is running properly and giving me correct response. But I canât able to update the metafields from storefront so asking for help.
Hi @mritunjay4ever 
Would you please try the below query to verify that your current token has the read_products scope?
{
currentAppInstallation {
accessScopes {
handle
}
}
}
It is giving me this
{
"data": {
"currentAppInstallation": {
"accessScopes": [
{
"handle": "unauthenticated_read_product_listings"
},
{
"handle": "unauthenticated_read_product_tags"
},
{
"handle": "unauthenticated_write_checkouts"
},
{
"handle": "unauthenticated_write_customers"
},
{
"handle": "unauthenticated_read_customer_tags"
},
{
"handle": "unauthenticated_read_content"
},
{
"handle": "unauthenticated_read_checkouts"
},
{
"handle": "unauthenticated_read_customers"
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 2,
"actualQueryCost": 2,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 998,
"restoreRate": 50
}
}
}
}
@ShopifyDevSup Any reply will be helpful as I am stuck.
Hi @mritunjay4ever , it doesnât appear that the app has the âread_productsâ access scope enabled. If it was working you could expect to see the response as per the example here, https://shopify.dev/api/admin-rest/2022-10/resources/accessscope,
HTTP/1.1 200 OK
{
âaccess_scopesâ: [
{
âhandleâ: âread_productsâ
}
If you canât resolve why the scopes arenât being added you could try to reach out to our Partner support and provide details of the app so they can check the internal status.
I had the same problem with the access to metaobjects. For those who have difficulties understanding the official documentation (like me
)
The point is that youâre looking at the wrong place: The definition for what your app is allowed to do is defined in your partner account:
In your partner account, go to âApps â <your appâs name>â. Then select the navigation entry âAPI accessâ. In the card âScopesâ you find the currently defined scopes.
To change these scopes, you have to edit the file âshopify.app.tomlâ in the folder of your app source code. There is a config entry access_scopes in which you add the scopes you need. In my case, it had to be:
[access_scopes]
scopes = "write_products,write_metaobjects"
Then update the settings by calling this:
shopify app config push
Then you restart your app. Very likely, in the Shopify admin UI, you (or your merchant) have to update the app because it is granted more permissions now. But thatâs just a few of the standard clicks, similar to installing the app.
1 Like