Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions b2b/manage/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Base URL of your ThunderID deployment. ex: https://localhost:8090
VITE_THUNDERID_BASE_URL=https://localhost:8090

# OAuth2 Client ID for this app. ThunderID Console -> your application -> Overview.
VITE_THUNDERID_CLIENT_ID=your-client-id-here

# The handle of the flow that creates an agent. A standard install already has this one.
VITE_AGENT_ONBOARDING_FLOW_HANDLE=default-agent-onboarding-flow

# The part of ThunderID that guards admin information. A standard install already uses this default.
VITE_THUNDERID_RESOURCE=https://localhost:8090/mcp
28 changes: 28 additions & 0 deletions b2b/manage/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local
.vite
*.tsbuildinfo

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.env
3 changes: 3 additions & 0 deletions b2b/manage/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
node_modules
pnpm-lock.yaml
73 changes: 73 additions & 0 deletions b2b/manage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# ThunderID Manage

ThunderID Manage is a sample app for trying out the ThunderID React SDK on B2B management services. An administrator signs in and manages the resources of a ThunderID server from one place. It is a React (Vite + TypeScript) app built with the [ThunderID React SDK](https://www.npmjs.com/package/@thunderid/react).

## What's included

- **Home**: a short page that explains what the app is for.
- **Agents**: the agent onboarding experience, built with the SDK's React components. You can see the agents on your server, create one through the ThunderID agent onboarding flow, and delete one.

When you create an agent, the app starts the onboarding flow that lives on your ThunderID server. The SDK draws each step the flow sends back: who owns the agent, the agent's details, and the new credentials. The client secret is shown once, hidden behind dots until you choose to show it.

These SDK components are used:

| Where | SDK component |
| -------------------------- | ----------------------------------------------------- |
| App setup | `ThunderIDProvider` |
| Top bar and home page | `SignInButton`, `SignedIn`, `SignedOut`, `Loading` |
| Signed-in user | `UserDropdown`, `User` |
| Agents pages | `ProtectedRoute` (from `@thunderid/react-router`) |
| Create agent | `BaseInviteUser`, which runs the flow and draws steps |
| Owner step | The user picker (`BaseUserSelect`) |
| Details and dropdown steps | `TextField`, `Select` |
| Credentials step | `CopyableText`, with the secret hidden until shown |
| Buttons | `Button` |

The app also uses the SDK hooks `useThunderID`, `useFetchUsers`, `useFetchAuthFlows`, `useFetchUserTypes`, `useTheme` and `useTranslation`. The organization unit dropdown and the step buttons are drawn by the app itself, through the SDK's custom renderers.

## Prerequisites

- Node.js 20+ and [pnpm](https://pnpm.io/)
- ThunderID React SDK 1.4.0 or later (`@thunderid/react`). It is the first release with the user picker (`BaseUserSelect` and `useFetchUsers`) and the masked `CopyableText` that this sample uses. `pnpm install` fetches it, together with `@thunderid/react-router` 1.3.0.
- A running ThunderID server (defaults to `https://localhost:8090`) and an administrator account
- The agent onboarding flow on that server. A standard install already has one, named `default-agent-onboarding-flow`.

New to ThunderID with React? Follow the [React quickstart guide](https://thunderid.dev/docs/next/getting-started/connect-your-application/react/) to set up a ThunderID server and connect a React app to it.

## Setup

1. Start your ThunderID server.

2. In the ThunderID Console, [create a React application](https://thunderid.dev/docs/getting-started/connect-your-application/react/#:~:text=2-,Create%20an%20Application,-Sign%20in%20to). Use `http://localhost:5173` as the redirect URL, and copy the client ID it gives you. Then add `http://localhost:5173` to the allowed origins (Settings → CORS), or the browser will block the sign-in requests.

3. Configure the app:

```bash
cp .env.example .env
```

| Variable | Description |
| ----------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `VITE_THUNDERID_BASE_URL` | Base URL of your ThunderID server. |
| `VITE_THUNDERID_CLIENT_ID` | Client ID of the application (from step 2). |
| `VITE_AGENT_ONBOARDING_FLOW_HANDLE` | Handle of the flow that creates agents. Defaults to `default-agent-onboarding-flow`. |
| `VITE_THUNDERID_RESOURCE` | Optional. The part of ThunderID that guards admin information. A standard install already uses the default. |

4. Install and start:

```bash
pnpm install
pnpm dev
```

5. Open `http://localhost:5173` and sign in as an administrator.

Only administrators can use the Agents section. Anyone else can sign in, but the server turns down the requests and the page shows an error.

## Docs

- Full SDK reference: [thunderid.dev/docs](https://thunderid.dev/docs)

## License

Apache License 2.0.
11 changes: 11 additions & 0 deletions b2b/manage/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2026 The ThunderID Authors
// SPDX-License-Identifier: Apache-2.0

import thunderIdPlugin from '@thunderid/eslint-plugin';

export default [
{
ignores: ['dist/**', 'build/**', 'node_modules/**', 'coverage/**'],
},
...thunderIdPlugin.configs.react,
];
13 changes: 13 additions & 0 deletions b2b/manage/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ThunderID Manage</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
36 changes: 36 additions & 0 deletions b2b/manage/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "@thunderid/manage",
"private": true,
"version": "0.0.0",
"description": "ThunderID Manage app, where an administrator manages ThunderID resources such as agents.",
"license": "Apache-2.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"preview": "vite preview",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
"lint:fix": "eslint . --fix --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
"format:check": "prettier --check --cache .",
"format:fix": "prettier --write --cache ."
},
"dependencies": {
"@thunderid/react": "1.4.0",
"@thunderid/react-router": "1.3.0",
"react": "19.2.3",
"react-dom": "19.2.3",
"react-router": "8.3.0"
},
"devDependencies": {
"@thunderid/eslint-plugin": "1.0.1",
"@thunderid/prettier-config": "1.0.1",
"@types/node": "24.7.2",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"@vitejs/plugin-react": "6.0.2",
"eslint": "9.39.5",
"prettier": "3.6.2",
"typescript": "5.9.3",
"vite": "8.0.16"
}
}
Loading
Loading