6

I'm trying to make a GitHub App that can view the private repositories and members of my organization that it's installed on. It has read access to "checks, members and metadata" on the installed apps page of the organization.

I can use the request curl -i -H "Authorization: token {token}" -H "Accept: application/vnd.github.machine-man-preview+json" https://api.github.com/installation/repositories to list the repositories and that seems to work, although I don't have private repositories on it right now to verify, but it does list the public ones.

However I can't seem to find an endpoint that lists the organization's private members for the installation, which is what I'm authenticated as. https://api.github.com/orgs/{org}/members shows just the public members of my organization, and if I try /members/{private member} I get a 302, which means my app is not a member of the organization. What am I doing wrong?

xSpartanCx
  • 281
  • 3
  • 10
  • 25
  • This seems to be a duplicate of https://stackoverflow.com/questions/41839662/get-a-list-of-all-our-private-repos – Kwame Opare Asiedu Dec 02 '19 at 00:03
  • It's not a duplicate, that's referring to using user credentials or a personal access token and I'm asking about accessing as a GitHub App Installation – xSpartanCx Dec 02 '19 at 01:03
  • @xSpartanCx Have you found a solution to get the private members of an organisation as well? – xxjaylxx Oct 04 '21 at 10:05

1 Answers1

0

The access will be granted to user who is registered with the specific organization and similarly the application needs to have scope to access. Refer scope in Organization Settings->Developer Settings-> Personal Access Tokens

Please find the reference below which are tested GITHUB APIs, please change the endpoint urls as per below suggestions. Note: replace <> with your appropriate email, org details accordingly.

For accessing all the members(public & private):
curl -u "<user email address>" https://api.github.com/orgs/<organization name>/members

For accessing all the repos(public & private):
curl -u "<user email address>" https://api.github.com/orgs/<organization name>/repos?type=all
Ramya
  • 31
  • 3
  • Not sure what your'e getting at here. The App does have the correct scope, but isn't authenticating as a user, it's authenticating as an installation using a private key under github.com/organizations//settings/apps/ – xSpartanCx Dec 08 '19 at 19:07