Validate that a github user is a member of a private organization
Is this possible? I tried looking at the organization's member list, but it only is showing public members. I have the user oauth'd with their token and metadata, but their current organizations don't seem to be included. Can I increase the scope to allow this kind of information to pass through?
An example using the Github API or node.js
github library would be fantastic. Either one works!
Should be possible.
From the API docs:
Org Members list - List all users who are members of an organization. A member is a user that belongs to at least 1 team in the organization. If the authenticated user is also an owner of this organization then both concealed and public members will be returned. If the requester is not an owner of the organization the query will be redirected to the public members list.
Therefore, in order to list Private members for an org, you have to be an owner of that org.
If you want to check if the authenticated user (e.g. yourself or someone else who's OAuth token you have) is a member of an org, get the list of the orgs for an authenticated user of via:
GET /user/orgs. Not sure which scope the OAuth token needs to have in case the org is private, but I'd guess you need
repo scope since that mentions private orgs.