I am trying to list a user's private github repositories via a github app.
(Note: I am not currently using OAuth, and I am looking for a user's repositories, not an org's.)
I am attempting to make this API call with an installation client, that is, using a client specific to an installation of an app and using a JWT with my private key.
This is the endpoint I am requesting:
https://api.github.com/user/repos?per_page=100&visibility=private
This yields the following response:
{
"message":"Resource not accessible by integration",
"documentation_url":"https://docs.github.com/rest/reference/repos#list-repositories-for-the-authenticated-user"
}
The /user/repos
not listed in the list of valid app endpoints so I'm not surprised this doesn't work.
Once a user installs my app, how can I list their private repos?
The way to do this is by calling the /installation/repositories
endpoint. An "installation" might have access to many repos across many users, and this endpoint will encompass them all.
This endpoint is documented here: https://docs.github.com/en/rest/reference/apps#list-repositories-accessible-to-the-app-installation