I would like to obtain the private member information of Organization from GitHub API, but somehow the acquisition using the access token obtained through OAuth authentication fails.I belong to an organization, and I make a special application for that organization.I would like to check if the users of the application belong to the member of Organization on GitHub.
Therefore, we performed the following steps:
In step 1, the access token was granted the following permissions in scope:
read: org (read-only access to organization, team, and membership)
read:user (allows access to read user profile data)
When I inserted my username and access token into the command below in step 3, I received a status code of "302".
curl --user "[My Username]:[My Access Token]" -s https://api.github.com/orgs/ [Group Name]/members/[Username]-o/dev/null-w"%{http_code}\n"
According to official GitHub API documentation
https://developer.github.com/v3/orgs/members/ #check-public-membership
Status: Response when 204 No Content requester is an organization member and user is a member
Status:302Found Requestor Not an Organization Member Response
It was returned that I am not an organization member.However, as a requestor, I am certainly a private member of our organization (not a public member).In fact, if you execute the following command using basic password authentication without using an access token, the status code changes to "204".This command is as follows:
curl --user "[My username]:[My password]" -s https://api.github.com/orgs/ [group name]/members/[my username]-o/dev/null-w"%{http_code}\n"
When I ran the following command to see if the access token could retrieve information for all members, only public members could be retrieved."Since I am a private member, this seems to be the reason why ""302"" was returned."
curl -- user "[My Username]:[Access Token]" https://api.github.com/orgs/[Organization]/members
I don't understand why an access token that allows [read:org][read:user] cannot get the private member information of org. Is there any other scope that I have to allow? I've been looking at GitHub developers, but I don't know. I'd appreciate it if you could tell me the cause of this.
api github oauth
Select the app in GitHub Settings > Application and see if the Organization is checked.You may also need permission between the app and org.
This post is @hinaloe's comments and @ I'll do my best I posted it as a community wiki based on your comment.
© 2024 OneMinuteCode. All rights reserved.