How to programatically remove a user from an org that I invited via email? #45673
Replies: 5 comments 5 replies
-
Hello and good day to you @andrewaustin It looks like you're trying to remove a user from your GitHub organization by their email address, but the API you're using (@octokit/rest) only supports removal by username. a way to work around this issue would be to store the invite_id and original email when you send the invite, then use the organization's webhooks member_added action to match the email to the username. Webhook documentation pseudocode -> try { |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Having the exact same issue as @andrewaustin - any updates to this problem since last year? - how can you find a link between an email/invitation and the username that ends up accepting the invitation? |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
When I started this discussion in January 2023, I later filed the following bug: https://github.com/orgs/community/discussions/45932 Since github has adopted a user hostile policy of closing unanswered questions, it's probably best to continue the discussion there since that one is marked as a bug and won't be auto closed (at least for now). |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
Hello,
I've building building an integration with github that takes an email and sends an invite to that user for my organization. I'm using the Node.js based
@octokit/rest
library, so my call is pretty simple:This works great and a successful response looks like:
So far so good. The problem arises when I want to programmatically remove a user using the email address from the org that I added via email. How can I do this? The API to remove a user from only supports removal via username, but I don't know the user's username, just their email.
Another wrinkle is that the invite goes out via email, but the the user can accept the invite for any account which can use any email and username. Is there a way to tie an invite to a username?
I thought maybe the organization's webhooks
member_added
action might give me some data to tie an invite to a user (if I persist the invite id and the original email, for example). This looks like:Looking at the response, there doesn't seem to be a relationship between the invite and the
member_added
event, or even the original user's email. Am I missing something? Is there really no way to remove a user via their email, or more importantly via their invite email?Beta Was this translation helpful? Give feedback.
All reactions