I have a Github app that I want to use to fetch the list of members in the organisation that has authorized my app.
I do the app installation “https://github.com/apps/{app_name}/installations/new” which returns the installation_id. Great, so far so good.
I can also use the installation_id to generate an access_token “https://api.github.com/app/installations/{installation_id}/access_tokens”. Great, so far so good.
I would expect that using either the installation_id or the access_token, I would be able to look up the name of the entity that installed my app. In the event that it is an organization, I would then like to use the name to fetch members using “https://api.github.com/orgs/{org_name}/members”.
However, there does not seem to be a way to do this without fetching all installations and then looping through to find the installation_id that I just received. Then pull out the org_name from there “https://api.github.com/app/installations”.
This approach does not seem optimal.
Any advice for a more straightforward approach?
I have gotten both an installation_id as well as an access_token. I would expect to be able to fetch organisation name directly with one of those two.
Mark Johnson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.