Token has not been granted the required scopes to execute this query


#1

I am trying to make this query in my app but get this error. It works fine in the graphql explorer

{
  repositoryOwner(login: "kesne") {
    avatarURL
    ... on User {
      bio
      company
      email
      location
      name
      websiteURL
      login
      createdAt
      followers(first: 30) {
        edges {
          node {
            name
            login
            avatarURL
          }
        }
      }
      organizations(first: 30) {
        totalCount
        edges {
          node {
            name
            avatarURL
          }
        }
      }
      following(first: 30) {
        edges {
          node {
            name
            login
            avatarURL
          }
        }
      }
    }
  }
}

"GraphQL error: Your token has not been granted the required scopes to 
execute this query. The 'name' field requires one of the following scopes: 
['read:org'], but your token has only been granted the: ['user', 'repo'] 
scopes. Please modify your token's scopes at: https://github.com/settings/tokens.

GraphQL error: Your token has not been granted the required scopes to 
execute this query. The '__typename' field requires one of the following scopes: 
['read:org'], but your token has only been granted the: ['user', 'repo'] 
scopes. Please modify your token's scopes at: https://github.com/settings/tokens."

https://github.com/ChrisWiles/githubViewer

Thanks


#2

@ChrisWiles are you still able to reproduce this error?


#3

Yes, still there


#4

@brandonblack I have narrowed the error down to this

    organizations(first: 30) {
      totalCount
      edges {
        node {
          name
          avatarURL
        }
      }
    }

This works here https://developer.github.com/early-access/graphql/explorer/

{
  repositoryOwner(login: "kesne") {
    avatarURL
    ... on User {
      bio
      company
      email
      location
      name
      websiteURL
      login
      createdAt
      followers(first: 30) {
        edges {
          node {
            name
            login
            avatarURL
          }
        }
      }
      organizations(first: 30) {
        totalCount
        edges {
          node {
            name
            avatarURL
          }
        }
      }
      following(first: 30) {
        edges {
          node {
            name
            login
            avatarURL
          }
        }
      }
    }
  }
}

but I get the error only for organizations query in my project


#5

:wave: @ChrisWiles,

Here are the scopes we request in the GraphQL explorer:

'user',
'public_repo',
'repo',
'repo_deployment',
'repo:status',
'read:repo_hook',
'read:org',
'read:public_key',
'read:gpg_key',

I’d be willing to bet that the token that you’re using to make the request in your application has something other than read:org (perhaps admin:org?). Unfortunately right now our GraphQL API doesn’t have support for “parent” scopes. It’s on our roadmap to fix.