How to list the user's orgs with a GitHub App token

Hello,

I installed a GitHub App in a GitHub Org

Then I did the procedure to get a token to be able to do requests to the GitHub rest api.

1) 

https://github.com/login/oauth/authorize?client\_id=GitHubAppClientId etc  

2) 

https://github.com/login/oauth/access\_token?client\_id=GitHubAppClientId etc

Then, when I request the user’s repos (https://api.github.com/user/orgs ), I got a list of all the repos , I mean the repos that belong to each one of the user’s orgs

If the user has 3 orgs , I got the repos belonging to each org.

But when I want to get the list of all the orgs , calling to https://api.github.com/user/orgs with the token, I got []

I requested all the permissions during the GitHub App installation.

How do I get the orgs list ? 

What am I doing wrong ?

If I use a personal access token I am able to get all the user’s orgs , but not when I use the token I got with the GitHub App

   

   

A GitHub App that is installed in an organization isn’t granted access to a user’s information even if the user is a member of the organization. Whether a user is a member of an organization is information that is tied to the user, not the organization. So to get the information of what organizations a user is a member of, you would need to have a user access token to make a user-to-server request.

I hope that helps!