Hello maybe someone know how to sove this…
when i try to get a metafield data from Storefront GQL API got this error:
“Access denied for metafield field. Required access: unauthenticated_read_metafields access scope.”
since storefront api are tokenless i’ve no idea where to set that ‘access scope’
this is a very basic request:
query {
product(id:"gid://shopify/Product/8795014037832"){
id
metafield(key:"product_care" namespace:"custom"){
id
}
}
}
and this is the response:
{
"errors": [
{
"message": "Access denied for metafield field. Required access: `unauthenticated_read_metafields` access scope.",
"locations": [
{
"line": 4,
"column": 5
}
],
"path": [
"product",
"metafield"
],
"extensions": {
"code": "ACCESS_DENIED",
"documentation": "https://shopify.dev/api/usage/access-scopes",
"requiredAccess": "`unauthenticated_read_metafields` access scope."
}
}
],
"data": {
"product": {
"id": "gid://shopify/Product/8795014037832",
"metafield": null
}
},
"extensions": {
"cost": {
"requestedQueryCost": 2
}
}
}
of course i’ve checked Shopify API access scopes
(even if it does have no sense for tokenless api)
and there is no unauthenticated_read_metafields option
plus querying the definition from the Admin GraphQL API i have PUBLIC_READ on storefront:
{
"data": {
"metafieldDefinition": {
"key": "product_care",
"namespace": "custom",
"name": "product_care",
"access": {
"storefront": "PUBLIC_READ" /*<=================*/
}
}
},
"extensions": {
"cost": {
"requestedQueryCost": 2,
"actualQueryCost": 2,
"throttleStatus": {
"maximumAvailable": 2000.0,
"currentlyAvailable": 1998,
"restoreRate": 100.0
}
}
}
}
any ideas?
what i’m doing wrong?