oauth - 403 Forbidden when using organizations api on github -
i have problem adding user organization using github api. i've used get request membership status organization i'm owner. response
get http://api.github.com/orgs/romanc-org/memberships/gromanc authorization: bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -- response -- 403 forbidden server: github.com date: tue, 15 aug 2017 10:34:33 gmt content-type: application/json; charset=utf-8 transfer-encoding: chunked status: 403 forbidden x-ratelimit-limit: 5000 x-ratelimit-remaining: 4995 x-ratelimit-reset: 1502793489 x-oauth-scopes: admin:org, repo, user x-accepted-oauth-scopes: admin:org, read:org, repo, user, write:org x-oauth-client-id: 212a8581bdca54d1f503 x-github-media-type: github.v3; format=json access-control-expose-headers: etag, link, x-github-otp, x-ratelimit-limit, x-ratelimit-remaining, x-ratelimit-reset, x-oauth-scopes, x-accepted-oauth-scopes, x-poll-interval access-control-allow-origin: * content-security-policy: default-src 'none' strict-transport-security: max-age=31536000; includesubdomains; preload x-content-type-options: nosniff x-frame-options: deny x-xss-protection: 1; mode=block x-runtime-rack: 0.027377 content-encoding: gzip x-github-request-id: 2f55:2b87:2e85f4a:6fc7673:5992ce39 { "message": "you must member of romanc-org see membership information gromanc.", "documentation_url": "https://developer.github.com/v3/orgs/members/#get-organization-membership" } i tried fetch other users status faile same error.
i tried put user organization get
put http://api.github.com/orgs/romanc-org/memberships/bt080527 authorization: bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx content-type: application/json { "login": "bt080527", "id": 30951532, "avatar_url": "https://avatars2.githubusercontent.com/u/30951532?v=4", "gravatar_id": "", "url": "https://api.github.com/users/bt080527", "html_url": "https://github.com/bt080527", "followers_url": "https://api.github.com/users/bt080527/followers", "following_url": "https://api.github.com/users/bt080527/following{/other_user}", "gists_url": "https://api.github.com/users/bt080527/gists{/gist_id}", "starred_url": "https://api.github.com/users/bt080527/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/bt080527/subscriptions", "organizations_url": "https://api.github.com/users/bt080527/orgs", "repos_url": "https://api.github.com/users/bt080527/repos", "events_url": "https://api.github.com/users/bt080527/events{/privacy}", "received_events_url": "https://api.github.com/users/bt080527/received_events", "type": "user", "site_admin": false, "name": null, "company": null, "blog": "", "location": null, "email": null, "hireable": null, "bio": null, "public_repos": 0, "public_gists": 0, "followers": 0, "following": 0, "created_at": "2017-08-12t09:57:40z", "updated_at": "2017-08-12t09:57:40z" } -- response -- 403 forbidden server: github.com date: tue, 15 aug 2017 10:47:51 gmt content-type: application/json; charset=utf-8 transfer-encoding: chunked status: 403 forbidden x-ratelimit-limit: 5000 x-ratelimit-remaining: 4997 x-ratelimit-reset: 1502797454 x-oauth-scopes: admin:org, repo, user x-accepted-oauth-scopes: admin:org, repo x-oauth-client-id: 212a8581bdca54d1f503 x-github-media-type: github.v3; format=json access-control-expose-headers: etag, link, x-github-otp, x-ratelimit-limit, x-ratelimit-remaining, x-ratelimit-reset, x-oauth-scopes, x-accepted-oauth-scopes, x-poll-interval access-control-allow-origin: * content-security-policy: default-src 'none' strict-transport-security: max-age=31536000; includesubdomains; preload x-content-type-options: nosniff x-frame-options: deny x-xss-protection: 1; mode=block x-runtime-rack: 0.200124 content-encoding: gzip x-github-request-id: 2fed:2b88:139a091:2bbe319:5992d157 { "message": "you must admin add or update organization membership.", "documentation_url": "https://developer.github.com/v3/orgs/members/#add-or-update-organization-membership" } what i'm doing wrong?
the reason why that's happening you're using token oauth application perform action on organization. organization has feature enabled:
https://help.github.com/articles/about-oauth-app-access-restrictions/
but application in question hasn't been whitelisted. so, feature kicks in , makes api behave not member of organization.
you'll either need whitelist application in question organization, or disable feature.
Comments
Post a Comment