Unable to list user repositories (or any other API call other than /user)


#1

Hi,
I’ve followed the guide how to “Identifying users on your site” and successfully got a Bearer token.
Unfortunately, when trying to list user’s repositories (public or private) I keep getting the same error message of “Resource not accessible by integration”.

My App doesn’t ask for any permissions other than PR RW access, commit status RW and reading a single file.

From the docs it seems metadata queries (such as /repositories) don’t require any special permissions and they are enabled by default.

Is there something that I’m missing?


#2

which route are you using to list the user’s repositories? Have you tried GET /users/:username/repos (https://developer.github.com/v3/repos/#list-user-repositories)? I think GET /users/repos is not enabled for GitHub apps yet, see https://developer.github.com/v3/apps/available-endpoints/. From what I can tell, GET /users/:username/repos should be enabled by default for GitHub apps: https://developer.github.com/v3/apps/permissions/#metadata-permissions


#3

@gr2m I tested all type of calls

  • /repositories
  • /users/octocat/repos
  • /search/repositories

All fail with the same error


#4

happy new year! Sorry to keep you wait that long, I still plan to investigate this, but I’ve been occupied with other things this past and probably next week.

If you figure out anything, please keep us posted :slight_smile:


#5

Hi Gregor!

Unfortunately, I have exactly the same problem as @bivas described – being able to access various endpoints my application returns Resource not accessible by integration error every time when I’m trying to hit any type of repositories list endpoints (even /installation/repositories or /user/installations/ID/repositories not mentioned above). My first thought was maybe something is wrong with authenticated user (private organization repositories influence perhaps), but the second user meets the same error :’(

I’ll be happy to share any details which could help in your investigation since this issue appears to be a major hiccup for all who are trying to switch from OAuth Apps to Github Apps.


#6

Hi guys! I think I eventually found out how to fix our problems!

Github application settings page has a required field Webhook URL where I used to set semi-random localhost-based path (obviously unavailable from the public). If you take a look at Advanced tab of your application you will realize that a bunch of the calls were sent to that imaginary endpoint and ended up undelivered. Long story short – I’m not 100% sure that exactly this change fixed my problem, but once I updated Webhook URL to the valid one (proxied by ngrok to my local dev server) all repositories calls started to return expected data.

Or maybe it was not me but @gr2m just successfully finished his investigation and forgot to mention it :wink:


#7

I’m always working with ngrok URLs so this solution will not work for me.
Maybe @gr2m did something, but I haven’t tested it again.


#8

sorry still have the investigation/auditing on my side on my backlog, but glad it is working now.

By the way I run into lots of trouble in the past with ngrok / localtunnel and the like, and I’m not the only one. The great folks from Probot created https://smee.io/ which is just mindblowingly amazin, you should all give it a try :slight_smile: Especially if you are building your apps with Probot, it has support for smee built in


#9

Hello,
I am having the same issue. I have a private repository, and my GitHub App is trying to get the readme content.The GitHub App has Repository contents set to read and write for all repositories.

GET /repos/:owner/:repo/readme

But I am getting this: {“message”:“Resource not accessible by integration”,“documentation_url”:“https://developer.github.com/v3/repos/contents/#get-the-readme”} message with the above get command.

Any advice would be awesome!
Thank you so much :slight_smile:

ps: I posted on a old thread but this one seems more active.


#10

@shivangipatwardhan20 is the repository included in the payload of /user/installations/:installation_id/repositories for your App’s installation?


“Resource not accessible by integration” when setting status as organisation
#11

FWIW we noticed that we only got the “Resource not accessible by integration” on private repos and not public repos. We then traced that back to the app missing the “Repository metadata” permission. Seems that this permission really only applies to private repositories. Public repos would, by definition, have their metadata public already.