Why am I getting 'access denied' when querying for activeSubscriptions in node app template?

Solved

Why am I getting 'access denied' when querying for activeSubscriptions in node app template?

originmaster
Shopify Partner
45 2 19

Hi all,

 

I'm building an app using the node app template cli-three. Inside of ensure-billing.js  there is a query for `activeSubscriptions` within the `currentAppInstallation` but I receive "access denied" in the response from Shopify. Here's the culprit query:

 

 

query appSubscription {
 currentAppInstallation {
  activeSubscriptions {
   name, test
  }
 }
}

 

 

I'm using api version `2022-07` and I have been approved for subscription access within the partner dashboard. My access scopes are: `read_customers,read_locales,read_orders,read_products,write_customer_payment_methods,write_own_subscription_contracts`

Here is the response:

 

 

{
 data: null,
 errors: [
  {
   message: 'access denied',
   locations: [ { line: 4, column: 7 } ],
   path: [ 'currentAppInstallation', 'activeSubscriptions' ]
  }
 ],
 extensions: {
  cost: {
   requestedQueryCost: 2,
   actualQueryCost: 2,
   throttleStatus: {
    maximumAvailable: 1000,
    currentlyAvailable: 992,
    restoreRate: 50
   }
  }
 }
}

 

 

Is there something I'm missing?

 

Thanks in advance!

 

Accepted Solution (1)

originmaster
Shopify Partner
45 2 19

This is an accepted solution.

After some research, this post helped me solve the issue.

 

Apparently you need to be the "store owner" to have access to activeSubscriptions (unfortunately the docs don't give any clues about this resulting in wasted time). This is only the case if you are using "online" tokens which give permissions based on the user who is logged in and using the app. User based permissions were not required for my project, so changing to "offline" tokens solved the issue.

View solution in original post

Reply 1 (1)

originmaster
Shopify Partner
45 2 19

This is an accepted solution.

After some research, this post helped me solve the issue.

 

Apparently you need to be the "store owner" to have access to activeSubscriptions (unfortunately the docs don't give any clues about this resulting in wasted time). This is only the case if you are using "online" tokens which give permissions based on the user who is logged in and using the app. User based permissions were not required for my project, so changing to "offline" tokens solved the issue.