domain
SDK

Shared flows

Hand an existing connection to another person without placing a bearer token in the URL.

Create the handoff on your application-authenticated server:

import { createSharedFlowUrl } from 'domain0'

const shared = await applicationClient.createSharedFlow({
  connectionId,
  expiresAt: new Date(Date.now() + 60 * 60 * 1000).toISOString(),
})

const url = createSharedFlowUrl('https://app.example/connect', shared.token)

The capability is placed in the URL fragment, so it is not sent in ordinary HTTP requests or access logs.

On the destination page:

await domain0.loadSharedFlow({
  apiBaseUrl: 'https://api.domain0.example/',
  url: window.location.href,
  origin: window.location.origin,
})

Resolution exchanges the opaque capability for short-lived connection access, then opens the standard dialog. Expired and invalid capabilities return the same public error.