Repository navigation
Public API for creating managed organization members #52986
Replies: 2 comments
|
Hi @ByteAfterlife, The good news is that this is already possible, just not as a single call. A recent change adds the ability to change an existing member's
This achieves the same outcome as calling Note this landed on main recently and hasn't shipped in a release yet. It'll be available starting with the next Keycloak release (26.8.0). One thing worth calling out for your use case: managed membership means the account's lifecycle is tied to the organization, so removing the member or deleting the organization will delete the underlying user account, not just unlink it. Worth keeping in mind if these "staff accounts" should ever outlive their org membership. We didn't expose |
|
No way! I guess me and the PR creator had the same thought. Thank you so much! |
Uh oh!
There was an error while loading. Please reload this page.
Is there a reason addManagedMember() isn't exposed through the Admin REST API?
Right now it seems like the only way to create a managed organization member programmatically is through the internal OrganizationProvider SPI:
organizationProvider.addManagedMember(organization, user);The Admin REST API can add existing users as organization members, but those are unmanaged.
I'd really like a supported API for this, e.g.:
POST /admin/realms/{realm}/organizations/{org}/managed-members
or a membershipType: MANAGED option on the existing endpoint.
My use case is having separate personal and organization-owned accounts in the same realm. For example, an employee might have their normal personal account, while their employer creates a separate staff account that is owned by the organization. Managed membership seems like exactly the right model for this, but currently I'd have to rely on an internal SPI to create it.
Would a public API for this be something Keycloak would consider?
All reactions