GraphQL error: scriptTagCreate access denied

Solved
pavindu
Tourist
11 0 4

 

 

II'm trying to add a script tag through scriptTagCreate mutation in the Shopify GraphQL app as follows.

 

mutation scriptTagCreate($input: ScriptTagInput!) {
  scriptTagCreate(input: $input) {
    scriptTag {
      id
    }
    userErrors {
      field
      message
    }
  }
}

 

with the following variables:

 

{
  "input": {
    "displayScope": "ALL",
    "src": "https://raw.githubusercontent.com/pavinduLakshan/model/master/liveview.js"
  }
}

 

 

However, I'm getting the following error.

 

{
  "data": {
    "scriptTagCreate": null
  },
  "errors": [
    {
      "message": "ScriptTagCreate access denied",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "scriptTagCreate"
      ]
    }
  ],
  "extensions": {
    "cost": {
      "requestedQueryCost": 10,
      "actualQueryCost": 10,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 990,
        "restoreRate": 50
      }
    }
  }
}

 

 

Does anyone know why is this happening? All helpful suggestions are highly appreciated. Thank you.

 

0 Likes
SBD_
Shopify Staff
Shopify Staff
1046 141 186

Hey @pavindu 

Does the app have write_script_tags scope?

0 Likes
pavindu
Tourist
11 0 4

I used Shopify's in-built GraphQL query explorer (Graphiql Editor) to execute requests. Since Shopify's GraphQL app is installed inside the Shopify store, I don't need to use any access token, do I?

0 Likes
SBD_
Shopify Staff
Shopify Staff
1046 141 186

This is an accepted solution.

That should be fine. Can you uninstall GraphiQL app, and then reinstall here: https://shopify-graphiql-app.shopifycloud.com/login making sure script_tags scope is selected?