FLOWDocs

Flow ID

Your identity and progress across Flow applications.

Flow ID connects your account and progress across Flow apps.

Set up an integration

The examples in these guides use @flow-industries/id. Your app needs a server route to own its first-party session cookies; loading the browser SDK alone is not enough.

bun add @flow-industries/id viem ox

Register your app's exact origin with the Flow ID issuer before enabling sign-in. The audience is the runtime origin, including scheme and port, with no path. On a server that uses the standard Request and Response APIs, mount the session handler before your other routes:

import { createSessionHandler } from "@flow-industries/id/server";

const session = createSessionHandler({
  audience: "https://your-app.example",
});

export async function fetch(request: Request): Promise<Response> {
  const handled = await session(request);
  if (handled) return handled;
  return new Response("Your application routes go here");
}

Replace the example audience with your registered app origin. The handler serves /flow/session, including the authorization callback. If you customize that path, configure the same path in the browser and server and register the full callback URL with the issuer.

Initialize the browser SDK once:

import { createFlow } from "@flow-industries/id";

const flow = createFlow();

Use createFlow({ autoGuest: true }) instead when you want guest sessions. createFlow() is browser-only; do not call it during server rendering. The default issuer is https://id.flow.industries. For another issuer, configure the server's FLOW_ID_HOST and the browser's host option consistently.

The session handler keeps access and rotating refresh cookies HttpOnly on your app's origin. Use flow.getToken() when an API requires a current bearer token. Never put tokens in navigation URLs or logs. flow.login() navigates to hosted sign-in and returns to the app; read restored state after navigation. For own-account settings, call flow.openAccount() from a user action to open Flow ID in a new tab.

For the complete integration, continue with Getting started, Concepts, and the SDK reference.

On this page