"Resource not accessible by integration" when querying "refs" via a GitHub App

Hello.

I’m building a GitHub App that will help people contribute to open-source projects. I’m having difficulty performing the following query using the accessToken generated by my GitHub App:

query {
  repository(owner: "desktop", name: "desktop") {
    latestBranches: refs(refPrefix: "refs/heads/", last: 3) {
      nodes {
        id
        name
      }
    }
  }
}

The query above should fetch the last 3 branches in the given public repository. However, it fails with the following error:

"errors": [
    {
        "type": "FORBIDDEN",
        "path": [
            "repository",
            "latestBranches"
        ],
        "extensions": {
            "saml_failure": false
        },
        "locations": [
            {
                "line": 21,
                "column": 9
            }
        ],
        "message": "Resource not accessible by integration"
    }
]

I’ve tried setting all the permissions possible in my GitHub App settings but that resulted in no change. I suspect you cannot query certain fields from a GitHub App?

I have the same issue with querying the defaultBranchRef field.

According to this reply, GitHub Apps now fully support GraphQL API, which is somewhat contradictory to what I’m experiencing.

Question

  • What permissions is my GitHub app missing in order to query the refs field?

Interesting, but using a custom OAuth instead of a GitHub App doesn’t have this issue. This does look like apps’ limitation.

Please, is there a page where such limitations are listed?