Skip to main content
Use this when each external customer maps to its own enterprise connection (a SAML or OIDC connection to their IdP, for example) instead of an Auth0 Organization. This example grants membership through SCIM groups belonging to that connection. It does not grant a user membership merely because they authenticated through the connection. This is an alternative to B2B via Organizations: no Auth0 Organization is involved anywhere in this model. A connection is the organization boundary here: a user reaches it through a SCIM group that belongs to it. See Direct connection memberships before relying on this model for users with no SCIM group.

Model

Mapping

“Link group to connection on creation” writes both the bookkeeping group --connection--> connection tuple (which connection owns this group) and the group#member --member--> connection tuple that grants every group member connection membership. A Check for a group member on the connection can resolve true; a user with no synced group membership has no connection membership from this mapping.

Direct connection memberships

Auth0’s user.created and user.updated event schema does not require context.connection, so a rule that depends on it can miss direct grants. A direct grant must also be removed when a user is deleted or their identities change. This example intentionally does not emit direct-user connection tuples. If your application needs to grant access to users without SCIM groups, give those memberships their own relation, direct_member, and include it in member. The mapping below reconciles and deletes only direct_member, so it never touches the group-derived membership: data.object.identities[].connection holds the connection’s name, not the connection ID that group.created uses, so map each name to its ID explicitly and ignore identities on connections you do not list. The mapping reconciles a user’s direct memberships on every user.created and user.updated, so a removed identity also loses its membership, and clears them on user.deleted:
The connection names appear in several places: both when expressions, the iterator source, and the name-to-ID map. When you add or rename a connection, change every one of them. If they disagree, the event fails: a name missing from the second rule’s list raises a write/delete conflict, and a name missing from the map fails to evaluate.
Replace the connection names and IDs with your own. Take them from your tenant’s Management API connection list, not from the optional context.connection. Reserve direct_member for this mapping: the filters match every user --direct_member--> connection tuple for the user, so any other writer to that relation would have its tuples removed. See Backfilling and reconciling for loading existing users.

Known limitations

  • Connection changes and deletion. This group mapping handles group.created and group.deleted, but does not reconcile a group moved between connections or clean up all group grants on connection.deleted. Reconcile mapping-owned group tuples if either occurs; do not delete unrelated memberships.
  • Roles. There’s no per-user role assignment tied to a plain connection. If you need roles here, assign them to the SCIM group itself; see Roles: a group, at the tenant level.