Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 4

Github API to accept organization invitation by member user

Is there github API to accept invitation? I am trying to update pending membership through PATCH /user/memberships/orgs/{org} but it throws the following error message -

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

 

I know I can accept invitation via email but I am looking for available github API.

 

Please help!

3 Replies
Community Manager
Message 2 of 4

Re: Github API to accept organization invitation by member user

HI @phoenix303,

 

Thanks for being here! That message does point to a permissions issue, do you a token from the organization's owner.


Best,
AndreaG

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Pilot Lvl 1
Message 3 of 4

Re: Github API to accept organization invitation by member user

Only the user themselves can accept the invitation, the org owner cannot accept it on their behalf.

 

If you're authenticated as a legacy OAuth app as the user with the 'org:write' scope, you can call this API with the user's token to have them accept their own invite: https://developer.github.com/v3/orgs/members/#edit-your-organization-membership

 

The app itself also needs to be authorized with Third-party access on the organization.

 

That said, I have a newer GitHub App where I am trying to do the thing, and it isn't working, so there may be other lingering issues.

Pilot Lvl 1
Message 4 of 4

Re: Github API to accept organization invitation by member user

This was fixed.

GitHub Apps can now use the user-to-server APIs to update org membership and accept org invites.

Thank you to the API team.