Query a user's membership of a specific org via an app-issued token

I am able to obtain whether I am a member of the group “pytorch” as follows:

curl -u kostmo:<my personal access token> https://api.github.com/user/memberships/orgs/pytorch

In contrast, using the OAuth mechanism of my Github App, I obtain an auth token for the user as described on this page:


This auth token can be used for certain API queries, e.g.:

curl -u kostmo:<obtained auth token> https://api.github.com/user

However, it does not work for the organization membership query:

curl -u kostmo:<obtained auth token> https://api.github.com/user/memberships/orgs/pytorch

It emits the response:

  "message": "You do not have access to this organization membership.",
  "documentation_url": "https://developer.github.com/v3/orgs/members/#get-your-organization-membership"

How can I grant my Github App the appropriate permissions to access this API endpoint on behalf of the user?

I found that similarly, with my Personal Access Token, the org membership for myself can be queried as follows:

curl -I -u kostmo:<my personal access token> https://api.github.com/orgs/pytorch/members/kostmo

Returns status 204.

However, it *cannot* be queried with the app-issued token:

curl -I -u kostmo:<obtained auth token> https://api.github.com/orgs/pytorch/members/kostmo

Returns status 404.

The app had been granted org:read permission.