GraphQL API for requestedReviewer does not return Team correctly

For PRs that have requested reviews, I am trying to find the User IDs of the reviewers. Since the [requestedReviewer](https://docs.github.com/en/free-pro-team@latest/graphql/reference/unions#requestedreviewer) union can contain both User and Team objects, I wrote the following query. The repository name and owner info have been obfuscated. This query works fine in the GitHub GraphQL API Explorer. Please see the obfuscated response following the query. However, when I use GraphiQL or CURL to run the same query, I get a different response. In particular, the Team object returns null, while the User object returns correct data.

I also used GitHub REST API to find similar info and able to retrieve Team data. I think this indicates the GraphQL API is unable to return correct Team objects when running outside of the GitHub GraphQL API Explorer. Please let me know if this can be resolved. Thank you very much

Query

{
  repository(name: "my-repo", owner: "my-org") {
    pullRequest(number: 6) {
      reviewRequests(first: 100) {
        nodes {
          asCodeOwner
          requestedReviewer {
            ... on User {
              id
            }
            __typename
            ... on Team {
              members(first: 100) {
                nodes {
                  id
                }
              }
            }
          }
        }
      }
    }
  }
}

Explorer Response

{
  "data": {
    "repository": {
      "pullRequest": {
        "reviewRequests": {
          "nodes": [
            {
              "asCodeOwner": true,
              "requestedReviewer": {
                "__typename": "Team",
                "members": {
                  "nodes": [
                    {
                      "id": "MQA6VXNlcjE2MTg2NzAy"
                    },
                    {
                      "id": "MQA6VXNlcjE5NTQxNDgx"
                    }
                  ]
                }
              }
            },
            {
              "asCodeOwner": false,
              "requestedReviewer": {
                "id": "MQA6VXNlcjQ4NTIzMzEw",
                "__typename": "User"
              }
            }
          ]
        }
      }
    }
  }
}

GraphiQL or Curl Response

{
  "data": {
    "repository": {
      "pullRequest": {
        "reviewRequests": {
          "nodes": [
            {
              "asCodeOwner": true,
              "requestedReviewer": null
            },
            {
              "asCodeOwner": false,
              "requestedReviewer": {
                "id": "MQA6VXNlcjQ4NTIzMzEw",
                "__typename": "User"
              }
            }
          ]
        }
      }
    }
  }
}

After talking to GitHub support, they mentioned that I am probably using different credentials in the GitHub GraphQL Explorer vs Curl/GraphiQL. Moreover, those credentials probably do not have matching permissions.

They were correct. For the token that I was using in my Curl and GraphiQL, I needed to add “Read-Only” access for Members.