Exchange
auth
Exchange
AuthBridge: exchange an upstream Clerk token for a scoped CauseLoop JWT.
Verification is real, not stubbed:
- When CLERK_JWKS_URL is configured we verify
subject_tokenagainst the Clerk JWKS via security._decode_rs256 (which enforces CLERK_AUDIENCE and authorized-parties/azp). A failed verification is a 401. - The verified Clerk
suband email claim resolve the CauseLoop user via external_id first, then email. Outside production we may JIT-fall back to the first seeded user; in production an unknown identity is a 403. - The workspace + role come from the requested (and member-checked) workspace or the user’s first active membership; we then mint a scoped token via sign_access_token (scopes derive from PERMISSIONS).
Dev fallback: when CLERK_JWKS_URL is NOT set and ENVIRONMENT != “production” we preserve the legacy seed-user behavior so local/mock dev keeps working. When CLERK_JWKS_URL is NOT set and ENVIRONMENT == “production” we refuse (503). (identity-architecture.md §3.1 token-exchange grant)
POST
Exchange
Body
application/json