In short and in plain language
Many firms buy in an online shop. There, each worker often has an account of their own. Each account has its own password.
With the firm's login, this is easier. You sign in with the account of your own firm. The shop does not see the password. It only learns who signs in.
The firm sets who may do what. Some may order. Some may approve orders. Others may only look.
When someone leaves the firm, the firm locks their account. Then they can not get into the shop any more.
If the firm's login fails, there is a way in for emergencies. We help you set it up.
A wholesale customer orders through several buyers in your B2B shop, some of them may approve orders above a value limit, and in the spring one of the buyers leaves the company. Her account in the company directory is disabled on her last working day, but in the shop her access with its own password stays active until somebody remembers it. Single sign-on through the company account closes this gap: the login runs through the customer's identity provider, the shop takes company, customer group and permissions from its data, and whoever leaves the company can no longer get into the shop either. This article shows how OpenID Connect works as the standard for this, how to map logins to the right company account and customer group, how to derive roles from groups, how blocking on departure takes effect, and when a fallback to local login still makes sense.
Key takeaways
- Only 39.8 percent of EU enterprises with 10 or more employees used at least two authentication mechanisms in 2024 (Eurostat). Customers who run a second factor in their company directory carry it into the B2B shop through single sign-on.
- OpenID Connect is an identity layer on top of OAuth 2.0 (OpenID Connect Core 1.0): the shop redirects buyers to their company's identity provider and receives a signed ID token instead of keeping a password of its own.
- Mapping to the company account uses issuer and identifier, iss plus sub, not the email address. The sub identifier is at most 255 ASCII characters long and is not reassigned by the issuer (OpenID Connect Core 1.0).
- The shop derives roles such as purchasing, approval and view-only from company directory groups at every login and grants only what the task requires. Debtor, customer group and credit limit stay under the ERP's control.
- When someone leaves, a blocked login alone is not enough: back-channel logout ends running sessions, SCIM reports active false, and with two-factor login a session should require a new login after no more than 24 hours (NIST SP 800-63B-4).
- Local login remains as a fallback for outages and customers without a directory, set per company account: with a second factor, or with a password of at least 15 characters when it is the only factor (NIST SP 800-63B-4).
Why business customers do not need yet another password
In a B2B shop, a customer account usually stands for a company with several people. One company account covers buyers, assistants, project leads and approvers, each needing a login of their own, because permissions and order history should be traceable to individuals. Every one of these logins is one more password the customer has to manage, and one more place where access can stay open after a staff change.
The European survey on ICT security in enterprises shows how far companies already protect their accounts. In 2024, 83.7 percent (Eurostat) of EU enterprises with 10 or more employees used strong password authentication, but only 39.8 percent (Eurostat) used a combination of at least two authentication mechanisms. Companies that have introduced a second factor usually did so in their own company directory. With single sign-on it applies to the shop as well, without the shop running its own multi-factor login.
Staff turnover is not a side issue here. In the Wirtschaftsschutz 2026 survey of 1,003 companies (Bitkom) with at least 10 employees and annual revenue of at least 1 million euros, 23 percent (Bitkom) of the companies that were victims of data theft, industrial espionage or sabotage named current or former employees acting unintentionally as perpetrators, and 19 percent (Bitkom) named employees acting intentionally. A shop login that keeps working after someone leaves is a gap of exactly this kind, even if it sits with the supplier rather than in-house.
Germany's federal IT security agency BSI describes the threat in its IT-Grundschutz: if IT operations receive no information about staff changes, accounts of employees who have left may not be deleted (BSI IT-Grundschutz ORP.4). Requirement ORP.4.A2 therefore demands that user IDs and permissions no longer needed are removed when staff changes occur (BSI IT-Grundschutz ORP.4). For a company's own staff, the exit process takes care of this. The supplier, however, only learns about a departure at the customer when someone tells them, and a connected company directory delivers exactly this information without anyone lifting a finger. What company login brings to the customer and the shop in detail:
- One login fewer: buyers sign in with the account they use every day anyway, including the second factor their company requires.
- Permissions from one source: whoever is in the approval group in the company directory may approve in the shop. If the group changes, the role changes at the next login.
- Blocking without a phone call: once the customer disables the account, access to the shop ends too, without the customer having to notify the supplier separately.
- Fewer support tickets: forgotten shop passwords and lockouts after failed attempts disappear for every user who comes in through the company account.
- What it does not replace: debtor, prices, credit limit and assortment still come from the ERP. Company login says who is signing in, not on which terms they order.
OpenID Connect: the standard behind company login
For logging in through external identity providers, OpenID Connect provides an open standard. The specification describes itself as a simple identity layer on top of the OAuth 2.0 protocol (OpenID Connect Core 1.0). OAuth 2.0 governs how an application obtains access, and OpenID Connect adds the answer to the question of who has logged in. In the terms of the specification, the customer's identity provider is the OpenID Provider and the shop is the relying party, the service that relies on this login.
For a shop with its own server, the authorization code flow is the right choice. The buyer clicks "Sign in with company account", the shop redirects them to their company's login portal, they sign in there with a password and, where required, a second factor, and the browser comes back to the shop with a short-lived code. The shop exchanges this code on the server side for an ID token that carries the issuer, the user's identifier and further details and is signed by the identity provider. For the code, the OAuth 2.0 standard recommends a lifetime of no more than 10 minutes (RFC 6749), and it may only be redeemed once.
Since January 2025, RFC 9700 has collected the current security recommendations for OAuth 2.0 (RFC 9700). For confidential clients such as a shop server, it recommends PKCE because it protects against the misuse and injection of authorization codes (RFC 9700). The shop creates a random verifier of 43 to 128 characters (RFC 7636) for each login and sends only a value derived from it; afterwards only whoever knows the verifier can redeem the code. The identity provider compares redirect addresses character by character with the registered ones (RFC 9700). That is why every shop domain, including the one of the test environment, has to be listed explicitly in the registration.
So that the shop does not maintain addresses by hand for each customer, an identity provider publishes its configuration as a JSON document at the path /.well-known/openid-configuration (OpenID Connect Discovery 1.0). It lists the endpoints for login and tokens, the address of the public keys for checking signatures, and the supported methods. Per business customer, the shop stores the issuer, a client ID and a secret or certificate; everything else follows from this document. The login flow at a glance:
| Step | What happens | What the shop watches for |
|---|---|---|
| Redirect | Shop sends the buyer to the identity provider with state, nonce and PKCE value | Redirect address registered exactly, values generated fresh for each login |
| Login at the customer | Password and second factor under the customer's rules | Shop sees no password and stores none |
| Return | Browser brings code and state back to the shop | Match state against its own session |
| Code exchange | Shop exchanges code and PKCE verifier for tokens on the server | Redeem the code immediately and only once |
| ID token check | Check signature, issuer, audience, expiry and nonce | Load keys from the discovery configuration |
| Shop session | Shop maps iss and sub to a customer account and starts the session | Recalculate roles, log the login |
{
"iss": "https://login.customer.invalid",
"sub": "AItOawmwtWwcT0k51BayewNvutrJUqsvl6qs7A4",
"aud": "b2b-shop",
"nonce": "n-0S6_WzA2Mj",
"email": "purchasing@customer.invalid",
"groups": ["shop-purchasing", "shop-approval"]
}The example shows the decoded content of an ID token, shortened by timestamps and signature. The groups entry is not one of the standard claims of OpenID Connect; which groups an identity provider issues under which name is agreed with each customer and belongs in the documentation of the integration.
Mapping company account and customer group
The first question after a click on "Sign in with company account" is: which company is this? A two-step screen works well in practice. The buyer first enters an email address, the shop recognizes from the domain which identity provider is responsible, and redirects. If no provider is stored for the domain, the screen shows the password field of the local login. For groups with several domains, or service providers who order for several customers, a selection list or the customer number complements the detection.
Behind the detection is a mapping that the shop maintains and reconciles with the ERP: the customer's issuer, the matching debtor in the ERP, the customer group in the shop, and the rules for which groups result in which roles. The debtor remains the leading key. How customer groups and approved assortments get from the ERP into the shop is covered in the article on customer approval with assortments from the ERP. Company login builds on exactly this mapping and does not replace it.
Within the company account, the shop has to recognize every user permanently. The specification is clear here: only sub and iss together form a stable identifier for the user, because sub is unique within an issuer and is not reassigned (OpenID Connect Core 1.0). The sub identifier may be at most 255 ASCII characters (OpenID Connect Core 1.0) long, and it is case-sensitive (OpenID Connect Core 1.0). The field in the shop has to reflect both, or two users merge into one.
The email address does not work as a key. An issuer may reuse the same email value for different people at different points in time, and a person's address may change (OpenID Connect Core 1.0). In everyday B2B business this is not an edge case: shared purchasing addresses move between people, and after someone leaves, their successor sometimes takes over the old address. Whoever maps accounts by email then hands the successor the order history and the permissions of the predecessor.
There are two ways to handle a user's first login. With just-in-time provisioning, the shop account is created when an unknown identifier arrives for the first time; the NIST guideline calls this the most common form in federation systems because it requires the least coordination between both sides (NIST SP 800-63C-4). With pre-provisioning, the company directory pushes accounts and attributes into the shop before anyone logs in. The first approach suits a B2B shop well when a blocking rule is added: an unknown identifier only gets an account if its issuer is mapped to an approved company account.
The switch is delicate for customers who already have local shop accounts. Order history should be kept, so the existing account is linked to the new identifier. This happens once and with confirmation: the user signs in with the old password or confirms an email sent to the stored address, and only then is iss plus sub saved to the account. The NIST guideline also requires notifying the user when a new federated identifier is added to their account (NIST SP 800-63C-4).
Do not merge accounts by email
Deriving permissions from groups
A company account in a B2B shop usually needs more than one kind of user. Typical roles are purchasing, approval and view-only: purchasing creates carts and orders within a value limit, approval authorizes orders above it, and view-only sees orders, invoices and delivery status but does not order. Instead of maintaining these roles by hand in the shop, the shop derives them from groups the customer already keeps in its directory.
The principle is the same as in-house: user IDs and permissions may only be granted based on actual need and the necessity to fulfill a task (BSI IT-Grundschutz ORP.4). Applied to the shop, a group in the company directory results in exactly the role it was agreed for, and a user without a matching group gets no account or only view-only access, depending on what was agreed with the customer. A mapping for a typical company account:
| Group in the company directory | Role in the shop | What the role may do in the shop |
|---|---|---|
| shop-purchasing | Purchasing | Create carts, order up to the company account's value limit, see own orders |
| shop-approval | Approval | Approve or reject orders above the value limit, see all orders of the company account |
| shop-view | View-only | See orders, delivery status and invoices, no ordering |
| shop-admin | Administration | Maintain delivery addresses and cost centers, release the local emergency access |
| no matching group | none | Login rejected, notice to the customer's administration |
The groups arrive fresh with the ID token at every login or are requested from the UserInfo endpoint. The shop then recalculates the roles instead of carrying forward permissions granted once. Anyone who changes groups in the directory has the new role at the next login. If a user stays logged in for longer, the change only takes effect with the next login. Session length is therefore a question of permission management, not only of convenience.
For the attributes the shop requests, data minimization under Article 5(1)(c) applies: personal data must be limited to what is necessary in relation to the purposes of processing (GDPR). For the login, the shop needs issuer and identifier, the name for salutation and documents, the email address for order confirmations, and the groups. The buyer's employee number, department, cost center or extension belong in it only if the shop needs them for a specific process, such as the cost center for the invoice.
What a user may do depends not only on the role but also on the terms of the company account, and those live in the ERP: value limits, credit limit, approved payment methods. Checking the credit limit is covered in the article on the credit limit check in the B2B checkout, mapping framework contracts in the article on call-off orders in the B2B shop. Whether the purchasing role may also pay by direct debit belongs in these rules as well; how mandate and return debit reach the ERP is shown in the article on SEPA direct debit in the shop.
Blocking on departure: when the company account ends
Single sign-on prevents new logins as soon as the account is disabled in the company directory. It does not end a shop session that is already running. If the buyer logged in on the morning of her last working day and the shop keeps sessions open for a week, her access remains until then. Effective blocking therefore consists of three building blocks that complement each other.
The first building block is a limited session length. The NIST guideline recommends, for logins at level AAL2, meaning with two factors, a fixed limit of no more than 24 hours (NIST SP 800-63B-4) until the next login and a limit of no more than 1 hour (NIST SP 800-63B-4) for inactivity. For the shop this means: once the period is over, it quietly redirects to the identity provider. If the user is still signed in there, they barely notice; if their account is disabled, access ends.
The second building block is the logout signal. OpenID Connect Back-Channel Logout defines a mechanism in which the identity provider informs the connected services of a logout directly from server to server (OpenID Connect Back-Channel Logout 1.0). The shop provides an endpoint for this, checks the signed logout token and ends all sessions for this identifier. Unlike logout through the browser, this also works when the buyer does not have the shop open at the moment. Whether an identity provider also sends the signal when an account is disabled has to be clarified for each customer.
The third building block is account management through SCIM, the System for Cross-domain Identity Management, an HTTP-based protocol for managing identities across organizational boundaries (RFC 7644). The company directory uses it to create accounts in the shop, change groups and, on departure, set the attribute active to false; according to the schema, true typically means that the user is able to log in, and false that the account has been suspended (RFC 7643). The shop thus blocks the account even if no further login follows, and ends running sessions immediately. With all three building blocks in place, a departure looks like this:
- The customer's IT disables the buyer's account in the company directory.
- The directory reports active false to the shop via SCIM and, if set up, sends a logout token to the logout endpoint.
- The shop blocks the shop account, ends all sessions and revokes tokens issued for apps or connected tools.
- Open approvals of that person move to another approver in the company account so that no order gets stuck.
- Orders, invoices and delivery addresses stay with the company account, not with the person, and remain visible to the successor.
- The log records when which signal arrived and what the shop blocked in response.
Blocked does not mean deleted. The NIST guideline distinguishes a disabled account, whose information is retained although access is no longer possible (NIST SP 800-63C-4), from a terminated account, where the service removes all access (NIST SP 800-63C-4). A shop may also terminate an account independently of the identity provider (NIST SP 800-63C-4). In a B2B shop, disabling is the normal case, because orders and invoices belong to the company account and are subject to retention obligations. The personal data of the person who left is then removed according to the deletion concept; how long login data may remain in logs is covered in the article on customer data in integration logs.
Fallback to local login
Not every customer has a company directory with OpenID Connect, and an existing one can fail. Local login with a shop password therefore remains, but as a controlled fallback per company account, not as a silent back door. Three settings cover the usual cases: company login only, company login with local emergency access for named people, and local login for customers without a directory.
Where local login remains, it needs at least the level the customer has in its own directory. For passwords used as the only factor, the NIST guideline requires a minimum length of 15 characters (NIST SP 800-63B-4); combined with a second factor they may be shorter, but no less than 8 characters (NIST SP 800-63B-4). The BSI IT-Grundschutz also requires a separate password for each application (BSI IT-Grundschutz ORP.4). A shop password identical to the company password cancels out the benefit of company login.
If a customer's identity provider fails, the shop should not switch all of that customer's users to passwords. A sensible approach is emergency access for a few named people at the customer, with a second factor, limited in time and logged. How a shop keeps selling when other systems fail is described in the article on ERP outages and fallback mode. The same pattern applies to login: rules defined in advance instead of decisions made during an incident.
Fallback without a back door
Where login connects between shop, middleware and ERP
Technically, login sits where the shop session is created. In a classic shop this is an extension of the customer login, in a headless frontend the API layer that issues sessions and context to the frontend. The mapping from issuer to debtor, the rules from group to role, and the endpoints for SCIM and logout belong in a separate, documented component, so they can be tested and versioned independently of the shop theme. This work is classic API development for shop and ERP.
The ERP needs to know little about company login. It keeps receiving orders for the debtor, supplemented by the ordering contact, and returns terms, approval limits and status. Where several systems are involved, a middleware between shop and ERP takes over reconciling debtors and distributing the role rules. Machine-to-machine access is a separate matter: interfaces without a user rely on the client credentials flow with short-lived tokens, as described in the article on OAuth 2.0 and token security.
Not every buyer comes through the login form. Some large customers order from within their procurement system; there, OCI punchout handles the login with separate credentials per customer. Both paths can be combined, but they should use the same mapping to the company account and the same roles. Anyone inventorying their interfaces under NIS2 lists identity providers, client registrations and keys in the same register as the other integrations; the framework is described in the article on NIS2 and API security.
Rollout in six steps
Survey customers and directories
Find out which business customers run a directory with OpenID Connect, which email domains belong to it and who is responsible on the customer side. This produces the list of the first company accounts.
Define the mapping
Store issuer, debtor and customer group per customer, agree on groups and roles with the customer and put them in writing, including the case without a matching group.
Set up the login
Register a client per customer, enter redirect addresses exactly, implement the authorization code flow with PKCE and the checks of signature, issuer, audience and nonce.
Link existing accounts
Link local accounts to iss and sub after confirmation by the user, keep the order history and inform users about the new way of signing in.
Settle blocking and fallback
Limit session length, connect back-channel logout and SCIM where the customer offers them, and define emergency access and password rules per company account.
Test and monitor
Run through login, group changes and departure with test users in the customer's directory, and add failed logins and blocking signals to the daily error list.
Find out which business customers run a directory with OpenID Connect, which email domains belong to it and who is responsible on the customer side. This produces the list of the first company accounts.
Store issuer, debtor and customer group per customer, agree on groups and roles with the customer and put them in writing, including the case without a matching group.
Register a client per customer, enter redirect addresses exactly, implement the authorization code flow with PKCE and the checks of signature, issuer, audience and nonce.
Link local accounts to iss and sub after confirmation by the user, keep the order history and inform users about the new way of signing in.
Limit session length, connect back-channel logout and SCIM where the customer offers them, and define emergency access and password rules per company account.
Run through login, group changes and departure with test users in the customer's directory, and add failed logins and blocking signals to the daily error list.
The tests follow the same rule as for every interface: separate test users and a separate client registration per environment, no real buyer accounts. How to separate test environments and test data for interfaces cleanly is described in the article on test environments for ERP interfaces. A single customer as a pilot shows whether mapping and roles fit before more company accounts follow. An overview of our interface work is available under services.
The company account says who signs in, the ERP says on which terms they order
Related Articles
Documenting Interfaces: OpenAPI Instead of Tribal Knowledge
Describe shop-ERP interfaces with OpenAPI: fields, error codes, examples and scopes, the description as a contract and the handover package for a switch.
Team AI assistants: ERP access via MCP with permissions
How internal AI assistants reach the ERP through the Model Context Protocol: business-level tools, per-user permissions, approval before writes, audit log.
eFTI from July 2027: Digital Freight Data from the ERP
From 9 July 2027, authorities must accept eFTI data, while paper stays allowed for merchants for now. Which fields the ERP supplies and what middleware checks.