Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 1

GraphQL - Retrieving a viewer's Pull Request IDs results in "Resource not accessible by integration"

I'm trying to perform the following GraphQL query:

query($page_size: Int!, $cursor: String) {
  viewer {
    ... on User {
      pullRequests(first: $page_size, after: $cursor, states:OPEN) {
        totalCount
        nodes {
            id
        }
      }
    }
  }
}

with these variables:

{
	"cursor": null,
	"page_size": 3
}

However, it always results in the following response:

{
    "data": {
        "viewer": {
            "pullRequests": {
                "totalCount": 7,
                "nodes": [
                    null,
                    null,
                    null
                ]
            }
        }
    },
    "errors": [
        {
            "type": "FORBIDDEN",
            "path": [
                "viewer",
                "pullRequests",
                "nodes",
                0
            ],
            "locations": [
                {
                    "line": 6,
                    "column": 9
                }
            ],
            "message": "Resource not accessible by integration"
        },
        {
            "type": "FORBIDDEN",
            "path": [
                "viewer",
                "pullRequests",
                "nodes",
                1
            ],
            "locations": [
                {
                    "line": 6,
                    "column": 9
                }
            ],

 

The authorization is via an 

Authorization: token <user's access token after app login>


I thought this was a permissions issue, but I tried giving the app Read permissions to pretty much everything and it still forbids me from accessing the Pull Requests data. However, the `totalCount` field is returned successfully.

Am I doing something wrong? This query works perfectly on the Explorer