client.connect.createLink(), redirects them to the returned connectUrl, and Corsair handles the rest. Hub hosts the connect page and OAuth callback. You mount a delivery endpoint and redirect.
See Hub overview for how the relay works. This page is the API reference.
Response shape
EverycreateLink call returns:
connectUrl. That is the entire client-side contract.
Setup
server.ts
ck_dev_…) locally and a production key (ck_prod_…) when deployed. See Environments.
Mount one route (optional catch-all so bare /api/corsair hits hub delivery too):
app/api/corsair/[[...path]]/route.ts
toNextJsHandler serves hub delivery and the management API on subpaths (/ok, /connect/links, etc.).
Hub optional overrides:
Hub delivers results to your handler. In development the SDK auto-detects the delivery URL; in production it uses the URL registered in the Hub dashboard.
Create a connect link
backend.ts
connect-button.tsx
Checking connection status
After a successful connect,useConnectionStatus({ tenantId }) reflects the new state:
status.tsx
refetch() after connect completes to update the dashboard.
Errors
All client errors surface as
CorsairClientError with these code values.