Files
src/fd/types.ts — generated
src/fd/session.ts — sign-in + refresh
src/fd/client.ts — the typed client
Usage
Server-side variant
In a Node server you’ll typically:- Sign in once at startup with a service account.
- Run a background timer that refreshes ~5 min before expiry.
- Switch
partnerIdper inbound request based on the authenticated user.
Caveats
`setPartnerId` is global
`setPartnerId` is global
The snippets above store session globally. In a Node server with
concurrent requests, don’t call
setPartnerId per request — race
conditions. Either (a) pass partnerId per call to a thin wrapper, or
(b) use AsyncLocalStorage to scope the session per request.MFA-enabled accounts
MFA-enabled accounts
signIn above throws on Challenge. For interactive flows, handle
the challenge response and call PUT /auth/challenge/mfa-token. See
Authentication.The retry middleware re-fetches the raw URL
The retry middleware re-fetches the raw URL
It loses the original middleware chain on retry. If you need
middleware-applied retries, lift the retry logic out of middleware
and into your own request helper.