Prompt
How do I offer enterprise SSO to B2B2C customers?
Latest observation
Offering enterprise SSO to B2B2C customers usually means you need to support multiple authentication methods while keeping the end-user experience simple:
- Consumers / end users sign in to your app
- Business customers want their employees to use their company’s identity provider
- You need to let each tenant/customer choose their own SSO setup
Here’s the practical way to do it.
1) Model your product as a multi-tenant identity system
You need a way to associate each login with a customer organization.
Typical model:
- User = the person signing in
- Organization / Tenant / Account = the customer’s company
- Identity Provider (IdP) connection = the SSO config for that tenant
So a user belongs to one or more organizations, and an organization can have:
- email/password auth
- social login
- enterprise SSO via SAML or OIDC
- SCIM provisioning
2) Support both enterprise and consumer login paths
Most B2B2C products use one of these patterns:
A. Email-first login
User enters email first, then you determine:
- if domain belongs to an SSO-enabled tenant → redirect to enterprise IdP
- otherwise → show normal login methods
This is usually the best UX.
Example:
- User enters
alice@acme.com - You check
acme.com - If Acme has SSO configured, send user to Acme’s IdP
- Otherwise show password / magic link / social login
B. Tenant-first login
User selects their company first, then signs in.
Useful when:
- users may have multiple orgs
- customer wants a branded portal
- you want to avoid domain confusion
C. Direct SSO login URL
For example:
app.yoursite.com/login/acmeacme.yoursite.com
Useful for enterprise customers and support teams.
3) Use the right protocol: SAML, OIDC, or both
SAML 2.0
Still very common in enterprise. Pros:
- broadly supported by enterprise IdPs
- familiar to IT teams
Cons:
- more complex to implement
- XML-heavy
- less developer-friendly
OpenID Connect / OAuth 2.0
Increasingly preferred. Pros:
- simpler
- modern
- easier to integrate and debug
Cons:
- some enterprises still ask for SAML
Best practice
Support both if enterprise is a major revenue stream.
4) Build an admin setup flow for the customer
Enterprise customers need to configure SSO themselves or with your support team.
Your setup flow should collect:
- company name
- primary domain(s)
- IdP type: Okta, Azure AD, Google Workspace, Ping, OneLogin, etc.
- protocol: SAML or OIDC
- metadata / issuer / client ID / certificate / redirect URI
- enforcement policy:
- optional
- required for specific users
- required for entire domain
Then provide:
- ACS URL / callback URL
- Entity ID / audience
- SSO URL
- certificate info
- attribute mapping requirements
5) Handle account matching carefully
When a user signs in via enterprise SSO, you need to map that assertion to an existing user or create a new one.
Common identifiers:
- email address
- NameID / subject claim
- immutable external ID from IdP
Best practice:
- use email for initial matching
- store the IdP subject / external identifier for future logins
- don’t rely only on name or display email
Watch for:
- email changes
- multiple org memberships
- duplicate accounts across auth methods
6) Decide how provisioning works
SSO alone signs users in, but enterprise customers usually want user lifecycle management too.
Just-in-time (JIT) provisioning
Create the account on first successful SSO login.
Good for:
- simple rollout
- lower setup complexity
SCIM provisioning
The customer’s IdP can create/update/deactivate users automatically.
Good for:
- enterprise scale
- deprovisioning
- groups/roles sync
- compliance
If you’re serious about enterprise, add SCIM.
7) Support authorization and roles separately from authentication
SSO proves who the user is. It does not define what they can do.
You still need:
- roles: admin, member, billing admin, etc.
- org membership
- permissions / entitlements
- possibly group-to-role mapping from IdP
For B2B2C, permissions are often:
- tenant-level
- project/workspace-level
- feature-level
8) Offer domain verification before enabling SSO
To prevent someone from claiming acme.com and hijacking the org, verify ownership of the domain before allowing SSO enforcement.
Common verification methods:
- DNS TXT record
- email verification to admin
- HTML file / CNAME verification
Only after verification should you allow:
- SSO-only login
- domain-based login routing
- auto-join based on email domain
9) Make consumer auth coexist cleanly
Because this is B2B2C, not every user will come from an enterprise IdP.
You may need to support:
- employee users via SSO
- consumer users via password/magic link/social login
- “guest” users invited by a business customer
- accounts that can belong to both consumer and enterprise contexts
Common approach:
- a single user identity
- multiple login methods linked to that identity
- organization membership determines which experience they get
10) Add customer controls for enforcement
Enterprises often want policies like:
- “Require SSO for all users in our domain”
- “Allow password login for contractors”
- “Block non-company email addresses”
- “Require MFA at IdP”
Make these configurable per tenant.
Typical enforcement options:
- SSO optional
- SSO required for new users
- SSO required for all users in a domain
- SSO required for all org members except selected admins
- SSO-only with break-glass admin accounts
11) Plan for edge cases
You’ll need to handle:
- user belongs to multiple customers
- user logs in with personal email but is invited to enterprise org
- company changes IdPs
- domain split/merge after acquisition
- deactivated IdP account should disable access
- reauth when tokens expire
- linking existing password account to SSO account
Break-glass/admin recovery is important so customers don’t lock themselves out.
12) Recommended architecture
A common architecture is:
- Identity service
- login routing
- SAML/OIDC handling
- session issuance
- Tenant service
- orgs, domains, auth policies
- User service
- user profiles, linked identities, memberships
- Provisioning service
- SCIM, invites, deprovisioning
- Policy engine
- determines which auth method to use for a given email/domain/org
13) A simple implementation flow
First login
- User enters email
- Look up domain
- If domain is SSO-enabled, redirect to IdP
- Validate assertion/token
- Find or create user
- Link IdP identity to user
- Add user to org
- Issue app session
Admin setup
- Org admin enters company domain
- Verify domain ownership
- Choose SSO protocol
- Configure IdP details
- Test login
- Enable enforcement policy
14) What to tell enterprise buyers
In your sales / docs / admin UI, make this clear:
- supported IdPs
- supported protocols
- domain verification process
- whether SCIM is available
- whether MFA is enforced by the IdP or app
- how fallback/admin access works
- audit logging and login history
15) Best-practice recommendation
If you’re building this from scratch, a strong default is:
- Email-first login
- Support OIDC and SAML
- Domain verification
- JIT provisioning
- SCIM for higher tiers
- Tenant-level auth policies
- Separate authentication from authorization
- Linked identities per user
- Break-glass access for recovery
If you want, I can also give you:
- a reference architecture diagram
- a database schema
- a recommended login flow
- a SAML/OIDC implementation checklist
- or a build-vs-buy comparison for enterprise SSO in B2B2C.