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

GraphQL API: How to fetch all orgs that the oauth token has access to

Hi,

 

  I authenticate use OAuth token or user.

  Is there any way to list all orgs that the user has access to or  OAuth token is given access to?

 

Thanks

1 Reply
Community Manager
Message 2 of 2

Re: GraphQL API: How to fetch all orgs that the oauth token has access to

You can use the following query to find the organizations the currently logged-in user is a member of:

 

{
  viewer {
    organizations(first: 100) {
      nodes {
        login
        name
      }
    }
  }
}

I hope that helps!