✳ Lambatoken / Mobile DocsAUTH 0.7.0 · WALLET 0.2.0
Integration / 18

Other microservices and token exchanges

Use the generic authenticated transport for services without a dedicated SDK.

Resource client

Register the audience and HTTPS origin during auth creation. The client acquires the correct token, refreshes when necessary and unwraps the data envelope. Paths below are illustrative except the existing user auth/me route; confirm service contracts.

typescript
const userApi = auth.createResourceClient({
  audience: "lbt-user-api", baseUrl: userUrl,
});
const profile = await userApi.get("/auth/me");

Preserve pagination and metadata

Use requestEnvelope for RTK Query or paginated screens. request/get unwrap data. Do not duplicate authorization headers or refresh logic.

typescript
const response = await userApi.requestEnvelope("GET", resourcePath);
// response.data and response.meta

Bind to a session and use idempotency

Long-lived domain clients should bind to the current generation. For a supported idempotent mutation, supply the same logical operation key when reconciling according to the resource contract. The SDK does not replay mutations.

typescript
const bound = auth.createResourceClient({
  audience: "lbt-user-api", baseUrl: userUrl,
  expectedGeneration: auth.interactionGeneration(),
});
// Only when the service supports the idempotency contract:
// await bound.post(resourcePath, body, { idempotencyKey });