Skip to main content
This guide walks an integrator through connecting a platform to the B Brands IdP. A generic ERP is used as the reference (first-party) client, but the steps generalize to any OIDC platform.
The IdP authenticates your users. Your platform manages its own authorization (roles/groups). The IdP never sends roles or permissions.

Integration summary

1. Register the OAuth client (B Brands side)

Create the client via the identity admin console or the management API. Register a distinct client per environment (<platform>-dev, <platform>-cert, <platform>-prod).
The response returns the client_secret and the provisioning webhook secret once — store them in your secret manager. Then enable pilot users:

2. Configure the client (your platform side)

Using your platform’s OIDC support, point auto-configuration at discovery and supply Client ID + Secret:
  • Discovery URL: https://auth.bbrands.io/.well-known/openid-configuration
  • Client ID: <UUID returned at onboarding>
  • Client Secret: <the one returned by the IdP>
Per-environment base URL (issuer): For manual configuration (production values shown):
Use a distinct client per environment. A non-production token must never be valid in production because the iss differs.
Validate the access token (issuer auth.*, aud = bbrands-idp, https://bbrands.io/client_handle = your handle) as the identity assertion. The id_token is signed with the same ES256 key but keeps the engine’s internal issuer, so do not pin your library’s issuer check to it — see Endpoints.
If your OIDC library only validates RS256 id_tokens (e.g. Odoo 18 with the OCA auth_oidc module): ask for your client to be registered with id_token_alg: "RS256". Your id_token is then delivered signed as RS256 (kid resolvable via the JWKS URL above, same claims), with no changes needed on your side beyond standard configuration. The access token remains ES256.

Validate the configuration

  1. Visit your login page — the “Sign in with B Brands” button should appear.
  2. Click it → you should be redirected to …auth.bbrands.io/api/v3/oauth/authorize?….
  3. After authorize, the browser is redirected to …auth.bbrands.io/oauth/consent?… (same origin) and, without a session, to the B Brands login first.
  4. With an active B Brands session and an enabled user → auto-approve → back to your platform, logged in.

3. Identity mapping

On each login, look the user up by (provider, external id = sub). Recommended behavior when not found: reject with “request access from your admin” (users must be pre-provisioned). The JIT alternative (auto-create) is only for flows where pre-sync is impossible.
Both the access token and the UserInfo response include the https://bbrands.io/profile object: account is the B Brands account bound to the user through the primary_user role, odoo is that account’s external system id (null until it is mapped by the migration API) and user mirrors sub. Use it to link the login to your own customer record without extra API calls.

4. Provisioning webhook

Expose an endpoint that the IdP calls when access changes. Verify the HMAC signature, then create/update or deactivate the user. Assign your own groups — the IdP does not send roles.

Webhook payload

Headers: X-BBrands-Signature (hex HMAC-SHA256 of the body), X-BBrands-Event-Id, X-BBrands-Delivery-Attempt.
Expected responses: 2xxdelivered; 4xxfailed (no retry, e.g. invalid signature); 5xx/timeout → exponential backoff retry, then dead_letter + admin alert. Use event_id for idempotency against retries.

5. Consuming the B Brands APIs (with user)

When acting in the context of a logged-in user, exchange the OIDC token for an internal B Brands JWT and use it as a Bearer. Details and error handling in Token exchange.

6. Machine-to-machine

A nightly sync cron has no interactive user, so it does not use OAuth or the exchange. It uses an existing B Brands API key, provisioned with least privilege.

7. Edge cases

8. Go-live checklist

1

Module installed

Integration module installed in production.
2

OIDC provider tested

Provider configured and verified in staging.
3

Secrets stored

Webhook secret and client secret stored encrypted.
4

API key provisioned

For the cron, with minimum permissions.
5

Exchange tested

OIDC → internal JWT tested for user-context flows.
6

Group policy defined

Your platform’s group assignment policy is defined.
7

Pre-provision list validated

User list validated with People/HR.
8

Runbooks & alerts

”Cannot authenticate” runbook published; webhook/login alerts configured.