A module representing organizations on Auth0.
Organizations are Auth0's B2B primitive: a tenant hosts many organizations, each
with its own members, connections and branding. Roles assigned through
assign_member_roles/3 are scoped to that organization, so the same user can be
an admin of one and a read-only member of another — which is the part of Auth0
RBAC most often misread.
Auth0 exposes two overlapping connection APIs here. This module implements
/connections, whose payload is a superset of the older /enabled_connections;
the latter is deliberately not wrapped.
Summary
Functions
Associates an existing client grant with an organization
Enables a connection for an organization. connection_id is required, and the
connection must already exist in the tenant.
Adds a discovery domain to an organization. domain is required.
Adds users to an organization. They must already exist in the tenant.
Gets all organizations.
Assigns roles to a group within this organization
Assigns roles to a member, scoped to this organization
Gets the client grants associated with an organization
Gets a single connection as enabled for this organization
Gets the connections enabled for an organization.
Creates an organization. name is required, and must be lowercase with no spaces.
Creates an invitation.
Deletes an organization
Revokes a pending invitation
Gets a discovery domain by id
Gets a discovery domain by the domain itself
Gets an organization's discovery domains.
Gets a single organization by id
Gets a single organization by name.
Gets the roles a group grants within this organization
Gets the groups assigned to an organization. Uses checkpoint pagination.
Gets a single invitation
Gets an organization's pending invitations
Gets the groups that grant a member a role in this organization, answering "why does this member have this role?".
Gets every role a member holds in this organization, including roles inherited through a group.
Gets the roles a member holds within this organization.
Gets an organization's members.
Removes a client grant from an organization
Disables a connection for this organization. The connection itself is not deleted.
Removes a discovery domain from an organization
Removes roles from a group within this organization
Removes roles from a member of this organization
Removes users from an organization. The users themselves are not deleted.
Gets the members holding a given role in this organization.
Updates an organization
Updates how a connection behaves for this organization
Updates a discovery domain
Functions
Associates an existing client grant with an organization
iex> Auth0Client.Management.Organization.add_client_grant("org_abc123", "cgr_1")
Enables a connection for an organization. connection_id is required, and the
connection must already exist in the tenant.
iex> Auth0Client.Management.Organization.add_connection("org_abc123", %{connection_id: "con_1", assign_membership_on_login: true})
Adds a discovery domain to an organization. domain is required.
iex> Auth0Client.Management.Organization.add_discovery_domain("org_abc123", %{domain: "acme.com"})
Adds users to an organization. They must already exist in the tenant.
iex> Auth0Client.Management.Organization.add_members("org_abc123", ["auth0|user1"])
Gets all organizations.
Supports offset pagination (page / per_page / include_totals), checkpoint
pagination (from / take), and sort.
iex> Auth0Client.Management.Organization.all()
iex> Auth0Client.Management.Organization.all(take: 50, sort: "name:1")
Assigns roles to a group within this organization
iex> Auth0Client.Management.Organization.assign_group_roles("org_abc123", "grp_1", ["rol_1"])
Assigns roles to a member, scoped to this organization
iex> Auth0Client.Management.Organization.assign_member_roles("org_abc123", "auth0|user1", ["rol_1"])
Gets the client grants associated with an organization
iex> Auth0Client.Management.Organization.client_grants("org_abc123")
iex> Auth0Client.Management.Organization.client_grants("org_abc123", audience: "https://api.example.com")
Gets a single connection as enabled for this organization
iex> Auth0Client.Management.Organization.connection("org_abc123", "con_1")
Gets the connections enabled for an organization.
Pass is_enabled to filter.
iex> Auth0Client.Management.Organization.connections("org_abc123")
Creates an organization. name is required, and must be lowercase with no spaces.
iex> Auth0Client.Management.Organization.create(%{name: "acme-corp", display_name: "Acme Corp"})
Creates an invitation.
inviter (with a name), invitee (with an email) and client_id are all
required. Unlike most mutations here, this returns the created invitation rather
than a bare :ok.
iex> Auth0Client.Management.Organization.create_invitation("org_abc123", %{
...> inviter: %{name: "Admin"},
...> invitee: %{email: "new@example.com"},
...> client_id: "a_client_id"
...> })
Deletes an organization
iex> Auth0Client.Management.Organization.delete("org_abc123")
Revokes a pending invitation
iex> Auth0Client.Management.Organization.delete_invitation("org_abc123", "inv_1")
Gets a discovery domain by id
iex> Auth0Client.Management.Organization.discovery_domain("org_abc123", "dom_1")
Gets a discovery domain by the domain itself
iex> Auth0Client.Management.Organization.discovery_domain_by_name("org_abc123", "acme.com")
Gets an organization's discovery domains.
Discovery domains route a user to an organization by their email domain — Home Realm Discovery. Uses checkpoint pagination.
iex> Auth0Client.Management.Organization.discovery_domains("org_abc123")
Gets a single organization by id
iex> Auth0Client.Management.Organization.get("org_abc123")
Gets a single organization by name.
The name is the lowercase, space-free identifier, not display_name.
iex> Auth0Client.Management.Organization.get_by_name("acme-corp")
Gets the roles a group grants within this organization
iex> Auth0Client.Management.Organization.group_roles("org_abc123", "grp_1")
Gets the groups assigned to an organization. Uses checkpoint pagination.
iex> Auth0Client.Management.Organization.groups("org_abc123")
Gets a single invitation
iex> Auth0Client.Management.Organization.invitation("org_abc123", "inv_1")
Gets an organization's pending invitations
iex> Auth0Client.Management.Organization.invitations("org_abc123")
Gets the groups that grant a member a role in this organization, answering "why does this member have this role?".
Pass role_id to narrow it to one role.
iex> Auth0Client.Management.Organization.member_effective_role_source_groups("org_abc123", "auth0|user1", role_id: "rol_1")
Gets every role a member holds in this organization, including roles inherited through a group.
member_roles/3 reports only direct assignments. Uses checkpoint pagination.
iex> Auth0Client.Management.Organization.member_effective_roles("org_abc123", "auth0|user1")
Gets the roles a member holds within this organization.
Not to be confused with role_members/3, which goes the other way — the members
holding a given role.
iex> Auth0Client.Management.Organization.member_roles("org_abc123", "auth0|user1")
Gets an organization's members.
Supports offset and checkpoint pagination, plus fields / include_fields.
iex> Auth0Client.Management.Organization.members("org_abc123")
iex> Auth0Client.Management.Organization.members("org_abc123", take: 50)
Removes a client grant from an organization
iex> Auth0Client.Management.Organization.remove_client_grant("org_abc123", "cgr_1")
Disables a connection for this organization. The connection itself is not deleted.
iex> Auth0Client.Management.Organization.remove_connection("org_abc123", "con_1")
Removes a discovery domain from an organization
iex> Auth0Client.Management.Organization.remove_discovery_domain("org_abc123", "dom_1")
Removes roles from a group within this organization
iex> Auth0Client.Management.Organization.remove_group_roles("org_abc123", "grp_1", ["rol_1"])
Removes roles from a member of this organization
iex> Auth0Client.Management.Organization.remove_member_roles("org_abc123", "auth0|user1", ["rol_1"])
Removes users from an organization. The users themselves are not deleted.
iex> Auth0Client.Management.Organization.remove_members("org_abc123", ["auth0|user1"])
Gets the members holding a given role in this organization.
The inverse of member_roles/3. Uses checkpoint pagination.
iex> Auth0Client.Management.Organization.role_members("org_abc123", "rol_1")
Updates an organization
iex> Auth0Client.Management.Organization.update("org_abc123", %{display_name: "Acme Corporation"})
Updates how a connection behaves for this organization
iex> Auth0Client.Management.Organization.update_connection("org_abc123", "con_1", %{show_as_button: false})
Updates a discovery domain
iex> Auth0Client.Management.Organization.update_discovery_domain("org_abc123", "dom_1", %{use_for_organization_discovery: true})