My Github App can access organization repo issues but can't access labels on an issue

A user has authorized my app to access a repo in an organization they are part of. I am able to list the repo’s issues via

https://api.github.com/repos/{ORG}/{REPO}/issues

However, when I try to access the issue’s labels like so:

https://api.github.com/repos/{ORG}/{REPO}/issues/1/labels

I get “Resource not accessible by integration”

2 Likes

Hey, are you using the GitHub API v3 or v4? 

For v3 see: https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository

I’m using v3.

Does that link help? Or is that not what you’re trying to do?

Hi Logan,

I’m already using the API as directed to get an issue’s labels and it works in all other cases. In this specific case, where a user is part of a certain organization, I cannot access the labels on an issue even though I can access the issue. Seems to be a strange organization permission I don’t understand.

Thanks

Matt

Got it. Per https://developer.github.com/v3/apps/permissions/#permission-on-issues my suggestion is to make sure you also have pull request permission. Seems as though some of those are intertwined. I think that will do the trick.

I do have “read” permission for Pull requests. Here are all the permissions my app requests:

Repository permissions

Administration: read

Issues: read+write

Metadata: read

Pull requests: read

Projects: read

Organization permissions

Projects: read

To add to the confusion, I can’t access a label search on this repo with an “access_token” on the URL. But if I remove the “access_token”, then I can access the search. This is the exact repo and label that works with no access token:

https://api.github.com/search/labels?repository_id=9759448&q=docker

If I add a random access_token, I rightfully get “Bad credentials”.

If I add the access_token that was granted to my app by a user that has admin permission on this repo, I get “Resource not accessible by integration”.   🤷‍♂️