GitHub App's user token can't list private repositories #48102
-
Select Topic AreaQuestion BodyI created a GitHub App (not OAuth App) and tried this API to list all private repositories with the user's token retrieved by OAuth web flow. However, it returned empty. Once I installed the GitHub App to one of my private repositories, the repository was returned but that's all. I couldn't see any other private repositories. Is there any way to list all private repositories which the authenticated user has access? Note: I added "Read-only" permission for content to the GitHub App. Note: I can't see the section like below in the GitHub App's settings.
|
Beta Was this translation helpful? Give feedback.
Replies: 15 comments 14 replies
-
I have the same issue, it's driving me bananas. I have an access token and I'm sending it (the /user/repos endpoint wouldn't work at all if I wasn't). I only get public repos back, no matter what I do. I gave the github app the following permissions, because I also want it to create and manage repositories: Repository Permissions: Administration (read-write), Contents (read-write), Metadata (read-only) Organization Permissions: Members (read-only) What am I missing? |
Beta Was this translation helpful? Give feedback.
-
Did anyone find a solution or the docs that point on how to list a users private repos? |
Beta Was this translation helpful? Give feedback.
-
Using GraphQL works but using api does not work for getting any private repos (org or user) |
Beta Was this translation helpful? Give feedback.
-
Please do lmk if u find a fix for this. :( |
Beta Was this translation helpful? Give feedback.
-
I finally found a solution! 😅 As mentioned here:
I went into my Developer settings, clicked the Github app > Install App |
Beta Was this translation helpful? Give feedback.
-
I still don't have this one resolved either. Glad to see others with the same problem. I have the app installed and have used the APP ID, Installation ID, and certificate to generate authentication with the app. These still only list the public repositories. Even when providing the Any help appreciated. May have to resort to the GraphQL call since that seems to work for folks. |
Beta Was this translation helpful? Give feedback.
-
I have run into this issue at the GitHub app level as well - when using the installation access token and corresponding installation client. |
Beta Was this translation helpful? Give feedback.
-
I am also having the same issue. Not sure whatelse to do. |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
I believe I am experiencing the same. The app is installed to my org with read contents and read metadata on all repositories in the org. I use the private key to generate an installation access token. Both python Github client and curl command using the token show no results for private repos. |
Beta Was this translation helpful? Give feedback.
-
There seems to be a related issue: https://github.com/orgs/community/discussions/113651 |
Beta Was this translation helpful? Give feedback.
-
I had this same issue, realised (as mentioned in the chosen answer) that the app needs to be installed as well as authorised. In my case, to redirect users to an install & authorise page instead of just the authorise page this was as simple as changing the URL that I was redirecting users to to authenticate with my app. Previous URL (only listed public repositories even with repository metadata permission set): https://github.com/login/oauth/authorize?client_id=YOUR_CLIENT_ID&state=STATE Correct URL for app install & authorise: https://github.com/apps/YOUR_APP_NAME/installations/new?client_id=YOUR_CLIENT_ID&scope=repo&state=STATE |
Beta Was this translation helpful? Give feedback.
This comment was marked as spam.
This comment was marked as spam.
-
https://github.com/orgs/community/discussions/48102#discussion-4880152 |
Beta Was this translation helpful? Give feedback.
I finally found a solution! 😅 As mentioned here:
I went into my Developer settings, clicked the Github app > Install App
After installing the app I would finally get the private repos in addition to the public ones in the response from /user/repos