I’m designing an Auth0 implementation for a B2B service business and would appreciate feedback on my approach.
Business context:
-
We provide a service to business accounts — sometimes an individual, sometimes a small group, sometimes a full company
-
Current auth is AD LDS with a single “owner” role for customers
-
We have multiple apps:
- Main app — serves existing customers (account management, service booking) and pre-customers (submit interest, work with sales before becoming
customers) - API consumer portal — separate app where company accounts manage their API keys and programmatic access
- Vendor apps — separate apps where vendors (e.g., catering, rental services) log in to update their offerings/inventory
- Main app — serves existing customers (account management, service booking) and pre-customers (submit interest, work with sales before becoming
-
We may need federated SSO for some company accounts in the future
-
A user can belong to multiple orgs (e.g., someone could be in a vendor org AND a customer org)
-
Each app restricts access based on org type — e.g., the main app rejects users who aren’t in at least one customer-related org
My proposed approach:
- One “general” organization for all individual customers and pre-customers who don’t have a dedicated company org
- Dedicated orgs for companies needing SSO (e.g., customer-microsoft) with email domain mapped to their IdP connection via Home Realm Discovery
- Roles for sales funnel progression: lead → prospect → prospect-demo → owner (used to gate UI features in the main app)
- Vendor orgs (e.g., vendor-catering-co) for vendor-specific apps
- Users can belong to multiple orgs — a person might be in vendor-catering-co AND customer-general if they’re both a vendor contact and a customer
- Each app validates org type at login — the main app checks the org claim matches customer-* pattern; vendor apps check for vendor-*; API portal checks
for orgs with API access enabled
Login flow (main app):
- User hits the main app → /authorize called → if user belongs to only one customer-type org, Auth0 resolves it automatically, no org picker
- If user is in multiple orgs (e.g., a vendor org + a customer org), the app passes the customer org explicitly since it knows which org type it cares
about - For federated users, HRD kicks in based on email domain → SSO → lands in their company org
My specific questions:
- Is a single “general” org for all non-federated customers the right pattern? Or should I avoid a mega-org with potentially thousands of users at
different lifecycle stages? - Is using roles for sales funnel stages (lead, prospect) alongside access roles (owner) going to cause problems? Should I use app_metadata or org-level
metadata for funnel stage instead? - Multi-org membership + app-level org-type restriction — is checking the org claim pattern (e.g., customer-* vs vendor-*) a reasonable authorization
approach? Or should I use permissions/RBAC per org instead? - Org picker avoidance — since a user can be in multiple orgs, but each app only cares about one type, what’s the best way to programmatically select
the right org? Should the app pass the organization param based on its own knowledge of which org the user belongs to for that context? What if the app
doesn’t know upfront? - Org migration path — when a pre-customer’s company later gets dedicated SSO, I need to move them from the general org to their company org. Are there
gotchas with the Management API here (token invalidation, sessions)? - M2M / API access — what’s the recommended pattern for org-scoped API credentials? Auth0’s client credentials flow is per-application, not per-org. How
are others handling “give company X their own API credentials scoped to their data”?
Any feedback on the overall architecture or things I’m not considering would be greatly appreciated.
Thanks!
