Set up Flows auth for React apps by detecting the classic or Apps API flow from app.json.

CCM score
66 of 100
skills.sh installs
1.9K
GitHub stars
6
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers both auth flows, choosing Apps API or classic from the infra field in app.json, and no-ops when valid auth is already wired
  • Installs the flow-specific packages (@cognite/dune or @cognite/app-sdk, plus @cognite/sdk, @tanstack/react-query, and vite-plugin-mkcert) using the detected package manager
  • Configures Vite with base: "./", mkcert(), and fusionOpenPlugin(), with manifestCspPlugin() required first for Apps API
  • Designed for migrating existing React apps to Flows or adding auth where no Flows provider is wired up

Install

$ npx -y skills add cognitedata/builder-skills --skill setup-flows-auth -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Set Up Flows Authentication

Wire a React app for Flows auth so it can talk to CDF inside Fusion. Two flows exist; pick one based on app.json.

Pick the flow

Read app.json if present:

app.json infraFlowAuth sourceExtra package
"appsApi"Apps API (new Fusion app host)connectToHostApp from @cognite/app-sdk@cognite/app-sdk
missing / otherClassic (legacy Files API)DuneAuthProvider + useDune() from @cognite/dune—

No app.json? Ask the user. Default to Apps API — it's the default for npx @cognite/cli@latest apps create.

Step 1 — Read state, decide whether to act

Read package.json, src/main.tsx (or src/index.tsx), vite.config.ts, app.json.

A valid setup already exists if any of these is true — in which case do nothing and report no-op:

  • Classic: <DuneAuthProvider> from @cognite/dune wraps <App /> in the entry file.
  • Apps API, provider pattern: <CogniteSdkProvider> from @cognite/app-sdk/react wraps the app (in App.tsx or main.tsx), and nested components consume the client via useCogniteSdk(). Requires @cognite/app-sdk >= 0.5.1.

Details

Repository
github.com/cognitedata/builder-skills
Categories
Frontend & UI Code, Backend & APIs
First seen
Jun 3, 2026

More from cognitedata/builder-skills

All 25

Similar to Setup Flows Auth

More Frontend & UI Code