We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Scopes not working for web pixel extension app

Scopes not working for web pixel extension app

andrerigon
Shopify Partner
4 0 11

Hi,

 

I'm following the web pixel docs here. Once the app is created, I:

 

  1. Build and deploy the app
  2. Publish the extension
  3. Install the app to my development store. 

The desired scopes in the shopify.app.toml are:

 

 

 

 

 

 

scopes = "write_pixels,read_customer_events,read_products"

 

 

 

 

 

 

But when I try to mutate the store to install the web pixel, it doesn't work. I get a reply saying that the write_pixel scope is not granted:

 

{
  "data": {
    "webPixelCreate": null
  },
  "errors": [
    {
      "message": "Access denied for webPixelCreate field. Required access: `write_pixels` access scope. Also: The app requires read_customer_events access scope and user access permission.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "webPixelCreate"
      ],
      "extensions": {
        "code": "ACCESS_DENIED",
        "documentation": "https://shopify.dev/api/usage/access-scopes",
        "requiredAccess": "`write_pixels` access scope. Also: The app requires read_customer_events access scope and user access permission."
      }
    }
  ],
  "extensions": {
    "cost": {
      "requestedQueryCost": 10,
      "actualQueryCost": 10,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 990,
        "restoreRate": 50
      }
    }
  }
}

When I use the shopify graphq app to query the scopes, its indeed not there. 

Query:

 

query {
  appInstallation {
    accessScopes {
      handle
      description
    }
  }
}

And result:

 

{
  "data": {
    "appInstallation": {
      "accessScopes": [
        {
          "handle": "read_content",
          "description": "Read store content like articles, blogs, comments, pages, and redirects"
        },
        {
          "handle": "read_products",
          "description": "Read products, variants, and collections"
        },
        {
          "handle": "unauthenticated_read_product_listings",
          "description": "Read product information"
        },
        {
          "handle": "unauthenticated_read_content",
          "description": "Read store content like articles, blogs, comments, pages, and redirects"
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 2,
      "actualQueryCost": 2,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 998,
        "restoreRate": 50
      }
    }
  }
}

 

It seems that the scopes requested in the app and defined in file are not being granted/requested propertly.

Any ideas?

 

Thank you!

 

 

 

Replies 8 (8)

yawlerman
Shopify Partner
3 0 0

@andrerigon Did you ever figure this out?  I'm experiencing the same issue.

andrerigon
Shopify Partner
4 0 11

Hi @yawlerman . After some installs/uninstalls it simply worked. I'm still not sure what happened. 

yawlerman
Shopify Partner
3 0 0

Oh boy, that sounds very reproducible.  Well no luck on my side after several install/uninstalls.  I'll keep trying. Thanks.

hitanshu88
Shopify Partner
12 1 11

When you are installing the app on the store, that time, in the app installation url, the scopes you request access for should contain "write_pixels,read_customer_events,read_products" scopes

QuarkAnalytics
Shopify Partner
2 0 1

Just want to bubble up: I'm still running into this issue and I'm using the latest shopify CLI as of Oct. 2023

RafayBetalogics
Shopify Partner
6 0 2

Did you found its actual solution, same problem at my end

QuarkAnalytics
Shopify Partner
2 0 1

Nope. I just sent Partner support an email. Please send them an email as well so we may increase the urgency on their end a bit.

Sahood
Shopify Partner
6 0 1

I had similar issue, I tried running on latest CLI latest version, it doesn't worked

but  I don't know why version  3.49.0 worked for me.