0
votes

I'm trying to fetch installed applications on Shopify store using private application (authenticated using ApiKey and ApiPassword) but I'm getting Access Denied error.

Im trying to get content of -> appInstallations

Described bellow on first place:

https://shopify.dev/docs/admin-api/graphql/reference/queryroot?api[version]=2020-04#connections-2020-04

Inside store I set api key to have all read permissions.

Im trying to execute using following query:

    $result = $api->graph('{
    appInstallations(first:10){
    edges{
    cursor
    }
    }
    }');

Output:

+container: array:3 [▼
      "data" => null
      "errors" => array:1 [▼
        0 => array:3 [▼
          "message" => "access denied"
          "locations" => array:1 [▼
            0 => array:2 [▼
              "line" => 2
              "column" => 9
            ]
          ]
          "path" => array:1 [▼
            0 => "appInstallations"
          ]
        ]
      ]

I tested API key for being valid by executing following GraphQL query:

   $result = $api->graph('{
  products(first: 50) {
    edges {
      cursor
      node {
        title
      }
    }
  }
}');

And it produced valid result with products list.

If You have any idea why it's acting this way please share answer with me.

Regards

1

1 Answers

0
votes

When you made the API key, you had to give it access scope permissions. Your key does not have the needed scope for the resource you are trying to get. You need to change the permissions on your key, so it has permission to access the installed Apps listing. Even though that is not a listed scope, you can probably find permission to set in the list of available ones for the setting of private keys.