Skip to main content
When a user clicks “Connect GitHub” in your dashboard, your backend calls 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

Every createLink call returns:
Redirect to connectUrl. That is the entire client-side contract.

Setup

server.ts
Use a development key (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.
backend.ts
In React:
connect-button.tsx

Checking connection status

After a successful connect, useConnectionStatus({ tenantId }) reflects the new state:
status.tsx
Call refetch() after connect completes to update the dashboard.

Errors

All client errors surface as CorsairClientError with these code values.