POST /api/v3/oauth/exchange
Implements a simplified RFC 8693-style token exchange.
string
required
The OIDC token issued by the IdP for the user (id_token or access_token).
string
Accepted for RFC 8693 parity; not enforced.
string
Accepted for RFC 8693 parity; not enforced.
What the endpoint does
1
Verify the subject token
ES256 signature against JWKS, plus
iss, aud, exp. Rejects expired or
invalid tokens with 401.2
Check the blacklist
If the token
jti is blacklisted, reject with 401.3
Resolve user and client
user_id from sub, client from the https://bbrands.io/client_handle
claim. A missing claim returns 401.4
Validate enablement
The user × platform access must be active and the client must be active.
Otherwise
403.5
Resolve the primary account & mint the JWT
Mint the internal HS256 JWT with
user_id, account_id,
token_use: "exchange", the client handle and a jti, with a short TTL
(default 900s, configurable). Log the issuance with
grant_type = token_exchange.Errors
Using the exchanged token
The client uses the returnedtoken as Authorization: Bearer ... against the
B Brands APIs. The existing internal authorizer validates the HS256 JWT and
resolves the user’s own permissions (internal RBAC). The Resource Server does
not change.
Security notes
- Short TTL is mandatory (default 900s). Never emit the long-lived traditional login token through this flow.
- The token is revocable via the blacklist by
jti. Both this endpoint and the internal authorizer reject blacklisted tokens. - There is no refresh for the internal token by design. When it expires, the client re-runs the exchange with a still-valid OIDC token.