diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
new file mode 100644
index 0000000..abc3c6b
--- /dev/null
+++ b/.github/workflows/e2e.yml
@@ -0,0 +1,125 @@
+name: 🎭 E2E
+
+on:
+ pull_request:
+ types: [opened, synchronize, reopened]
+ workflow_dispatch:
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+
+env:
+ NODE_VERSION: "lts/*"
+
+jobs:
+ discover:
+ name: 🔍 Discover E2E Suites
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ outputs:
+ suites: ${{ steps.find.outputs.suites }}
+ steps:
+ - name: 📥 Checkout Code
+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
+ with:
+ fetch-depth: 0
+
+ # Every tests/e2e//-e2e/ folder with a playwright.config.ts is a web suite for
+ # /. On a pull request, a suite runs only when its sample, the suite itself,
+ # or what every suite shares changed. A manual run takes every suite.
+ - name: 🔍 Find Changed Suites
+ id: find
+ env:
+ BASE_SHA: ${{ github.event.pull_request.base.sha }}
+ EVENT: ${{ github.event_name }}
+ run: |
+ if [ "$EVENT" = "pull_request" ]; then
+ changed=$(git diff --name-only "$BASE_SHA"...HEAD)
+ else
+ changed=""
+ fi
+ shared_changed=false
+ if [ "$EVENT" != "pull_request" ] || grep -qE '^(tests/e2e/(shared/|package(-lock)?\.json$|tsconfig\.json$)|\.github/workflows/e2e\.yml$)' <<<"$changed"; then
+ shared_changed=true
+ fi
+
+ suites=()
+ for config in tests/e2e/*/*-e2e/playwright.config.ts; do
+ suite=$(dirname "$config")
+ # A suite whose sample needs more than the latest ThunderID release offers carries a
+ # ci-skip file that says why. It still runs locally against a server that supports it.
+ if [ -f "$suite/ci-skip" ]; then
+ echo "Skipping ${suite#tests/e2e/}: $(head -n 1 "$suite/ci-skip")"
+ continue
+ fi
+ sample=${suite#tests/e2e/}
+ sample=${sample%-e2e}
+ if $shared_changed || grep -qE "^(${sample}|${suite})/" <<<"$changed"; then
+ suites+=("${suite#tests/e2e/}")
+ fi
+ done
+
+ json=$(printf '%s\n' ${suites[@]+"${suites[@]}"} | jq -R 'select(length > 0)' | jq -cs .)
+ echo "suites=$json" >> "$GITHUB_OUTPUT"
+ echo "E2E suites to run: $json"
+
+ e2e:
+ name: 🎭 E2E (${{ matrix.suite }})
+ needs: discover
+ if: ${{ needs.discover.outputs.suites != '[]' }}
+ runs-on: ubuntu-latest
+ timeout-minutes: 30
+ strategy:
+ fail-fast: false
+ matrix:
+ suite: ${{ fromJson(needs.discover.outputs.suites) }}
+ defaults:
+ run:
+ working-directory: tests/e2e
+ steps:
+ - name: 📥 Checkout Code
+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
+
+ - name: ⚙️ Set up Node.js
+ uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
+ with:
+ node-version: ${{ env.NODE_VERSION }}
+ cache: npm
+ cache-dependency-path: tests/e2e/package-lock.json
+
+ # Downloads the latest ThunderID release, runs its setup and starts it, the same way locally
+ # and in CI. The token only lifts the GitHub API rate limit for the latest-release lookup.
+ - name: 🚀 Start ThunderID (Latest Release)
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
+ run: ./shared/scripts/thunderid.sh start
+
+ - name: 📦 Install Dependencies
+ run: npm ci --no-audit --no-fund
+
+ - name: 📦 Install Playwright Browsers
+ run: npx playwright install --with-deps chromium
+
+ # The suite's global setup imports what the sample needs and creates the test users, and
+ # Playwright starts the sample itself, installing it from its own lockfile.
+ - name: 🎭 Run E2E Suite
+ run: npm test -w "${{ matrix.suite }}"
+
+ - name: 📤 Upload Playwright Report
+ if: ${{ failure() }}
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: playwright-report-${{ strategy.job-index }}
+ path: |
+ tests/e2e/${{ matrix.suite }}/playwright-report/
+ tests/e2e/${{ matrix.suite }}/test-results/
+ tests/e2e/.thunderid-server/server.log
+ retention-days: 14
+
+ - name: 🛑 Stop ThunderID
+ if: ${{ always() }}
+ run: ./shared/scripts/thunderid.sh stop || true
diff --git a/AGENTS.md b/AGENTS.md
index ede3c01..8e325ba 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -42,7 +42,8 @@ on a pull request.
- Put it under the area it belongs to and give it a `README.md` that follows the structure
below. Follow the sample-banner skill to render its banner.
-- Depend on the published SDK release, never a workspace or local path.
+- Depend on the latest published SDK release, never a workspace or local path. See
+ [SDK versions](#sdk-versions).
- Add a row to its area's table under `## Samples` in the root `README.md`, in alphabetical
order. A new area gets its own `### ` heading, a one-line description, and a
table, in the same order as the Layout table above, and a row in that Layout table.
@@ -92,6 +93,29 @@ for a mobile app) and adapt it rather than starting from scratch.
Write in plain, direct sentences. Link only to pages that exist; check thunderid.dev links
before adding them.
+## SDK versions
+
+Every sample uses the latest release of its ThunderID SDK, so a developer who copies one gets
+the current SDK and the code that goes with it.
+
+- **npm:** depend on each `@thunderid/*` package, including `@thunderid/eslint-plugin` and
+ `@thunderid/prettier-config`, as `"latest"`, never an exact or ranged version. The committed
+ `package-lock.json` records the release it resolved.
+- **Swift Package Manager:** `.package(url: "https://github.com/thunder-id/ios-sdks", from: "")`.
+- **pub:** `thunderid_flutter: ^`.
+- **Gradle:** JitPack has no `latest` alias, so use the latest release tag:
+ `com.github.thunder-id:android-sdks:v`.
+
+After an SDK release, move every sample that uses it to that release in one pull request. npm
+keeps a locked version that already satisfies `"latest"`, so `npm install` alone does not move
+it. In each sample, run `npm install @latest` for each `@thunderid/*` package, set the
+dependency back to `"latest"`, and run `npm install` again, then run the sample's format check,
+lint and build.
+
+Samples carry no compatibility with older SDK releases: no fallback settings, aliased
+environment variables, or notes for earlier versions. When a release changes what a sample
+needs, change the sample.
+
## Package manager
JavaScript samples use npm, so that a developer who copies one out needs nothing beyond Node.js.
diff --git a/b2b/wayfinder-enterprise-nextjs/.env.example b/b2b/wayfinder-enterprise-nextjs/.env.example
index 62687c7..42273dc 100644
--- a/b2b/wayfinder-enterprise-nextjs/.env.example
+++ b/b2b/wayfinder-enterprise-nextjs/.env.example
@@ -10,8 +10,8 @@ NEXT_PUBLIC_THUNDERID_AFTER_SIGN_IN_URL=http://localhost:3000
NEXT_PUBLIC_THUNDERID_AFTER_SIGN_OUT_URL=http://localhost:3000
NEXT_PUBLIC_THUNDERID_SCOPES=openid profile email roles ou booking:view booking:create booking:manage policy:view policy:manage user:view user:manage group:view group:manage role:view role:manage sso:view sso:manage
-# Encrypts the session cookie. Generate it with `openssl rand -base64 32`.
-THUNDERID_SECRET=
+# Encrypts the session cookie. At least 32 bytes; generate it with `openssl rand -base64 32`.
+THUNDERID_SESSION_SECRET=
# Where the app runs. The admin components reach the backend routes under /api/admin from here.
WAYFINDER_APP_URL=http://localhost:3000
diff --git a/b2b/wayfinder-enterprise-nextjs/README.md b/b2b/wayfinder-enterprise-nextjs/README.md
index 5d08645..e9886d8 100644
--- a/b2b/wayfinder-enterprise-nextjs/README.md
+++ b/b2b/wayfinder-enterprise-nextjs/README.md
@@ -91,7 +91,7 @@ Create your `.env.local`:
cp .env.example .env.local
```
-The other defaults match the import. In `.env.local`, set `THUNDERID_CLIENT_SECRET` and `WAYFINDER_BACKEND_CLIENT_SECRET` to the client secrets you set in `thunderid.env`, and `THUNDERID_SECRET` to a long random string; the SDK encrypts the session cookie with it. Generate one with:
+The other defaults match the import. In `.env.local`, set `THUNDERID_CLIENT_SECRET` and `WAYFINDER_BACKEND_CLIENT_SECRET` to the client secrets you set in `thunderid.env`, and `THUNDERID_SESSION_SECRET` to a random value of at least 32 bytes; the SDK encrypts the session cookie with it. Generate one with:
```bash
openssl rand -base64 32
@@ -104,7 +104,7 @@ openssl rand -base64 32
| `NEXT_PUBLIC_THUNDERID_APPLICATION_ID` | ID of the `Wayfinder Enterprise` application |
| `NEXT_PUBLIC_THUNDERID_AFTER_SIGN_IN_URL`, `NEXT_PUBLIC_THUNDERID_AFTER_SIGN_OUT_URL` | Where ThunderID returns the browser after sign-in and sign-out |
| `NEXT_PUBLIC_THUNDERID_SCOPES` | Scopes the app asks for: the organization and role claims, and the Wayfinder permissions |
-| `THUNDERID_SECRET` | Encrypts the session cookie |
+| `THUNDERID_SESSION_SECRET` | Encrypts the session cookie. At least 32 bytes, which production requires. |
| `WAYFINDER_APP_URL` | Where the app runs. The admin components reach the backend routes under `/api/admin` from here. |
| `WAYFINDER_API_RESOURCE` | The resource server whose permissions the app requests |
| `WAYFINDER_SIGN_IN_FLOW_ID`, `WAYFINDER_ADMIN_ROLE_ID`, `WAYFINDER_MEMBER_ROLE_ID`, `WAYFINDER_ADMIN_ROLE_NAME`, `WAYFINDER_USER_TYPE` | Resources the import creates with fixed IDs |
diff --git a/b2b/wayfinder-enterprise-nextjs/package-lock.json b/b2b/wayfinder-enterprise-nextjs/package-lock.json
index 7fda70f..3c1b82a 100644
--- a/b2b/wayfinder-enterprise-nextjs/package-lock.json
+++ b/b2b/wayfinder-enterprise-nextjs/package-lock.json
@@ -9,7 +9,7 @@
"version": "0.0.1",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/nextjs": "1.20.0",
+ "@thunderid/nextjs": "latest",
"next": "16.4.5",
"react": "19.2.3",
"react-dom": "19.2.3",
@@ -42,13 +42,13 @@
}
},
"node_modules/@babel/generator": {
- "version": "7.29.14",
- "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.14.tgz",
- "integrity": "sha512-qSY56jgW5JnSXzuekLVil6zaOQxOCtOHidr65KkaMBw772IuAY28Qx4ZykAcDn8+FRF15qk80XzKwgSc/RYW6g==",
+ "version": "7.29.16",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.16.tgz",
+ "integrity": "sha512-yRtddtrcYdLJt0l70aP7usb2YpMHNXAdAvJW2hXdka5boR4vKMS/F5BTR5sULkbht9xPk/EKzbY2mCczMutZqQ==",
"license": "MIT",
"dependencies": {
- "@babel/parser": "^7.29.14",
- "@babel/types": "^7.29.14",
+ "@babel/parser": "^7.29.15",
+ "@babel/types": "^7.29.15",
"@jridgewell/gen-mapping": "^0.3.12",
"@jridgewell/trace-mapping": "^0.3.28",
"jsesc": "^3.0.2"
@@ -80,9 +80,9 @@
}
},
"node_modules/@babel/helper-string-parser": {
- "version": "7.29.14",
- "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.14.tgz",
- "integrity": "sha512-CXvKMFvM80ihI7Vox9jb+kQjnyjESQNPM+vB7U0Zz6TWuZA+Z/FL0QPMH300h33qJtIx+REeBhXqWOPW48TcAQ==",
+ "version": "7.29.15",
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.15.tgz",
+ "integrity": "sha512-C2FuapQ2Kh1OnVHAoLi5rD3GBJ8COb9Q609T6HEpLqaBAo560PDP5OxBE5dCI/h951MBO/+bCUYU5SZ+8ZlV+w==",
"license": "MIT",
"engines": {
"node": ">=6.9.0"
@@ -98,12 +98,12 @@
}
},
"node_modules/@babel/parser": {
- "version": "7.29.14",
- "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.14.tgz",
- "integrity": "sha512-VL220vXuyO2z3rNIQwY7ftj9UwpqOt+33sH+sBWkOekbsSR2g7EEMnOx24ZlCH0xOA3DM/33SifVFGbnJD8r/w==",
+ "version": "7.29.15",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.15.tgz",
+ "integrity": "sha512-RpKWyisHoP81twtSCgmE02iU0RnPcq1DN5bBEbpUePrjA9Q3wXhufnCJrrayPpoZieqFh3zyZQqwtSK0gGccRA==",
"license": "MIT",
"dependencies": {
- "@babel/types": "^7.29.14"
+ "@babel/types": "^7.29.15"
},
"bin": {
"parser": "bin/babel-parser.js"
@@ -113,9 +113,9 @@
}
},
"node_modules/@babel/runtime": {
- "version": "7.29.14",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.14.tgz",
- "integrity": "sha512-Y5tqevQaUAZhhj82BpYMNC1ssvLQTVAfwKdm8iy8qwmhvC2/CpcAu8OC+QEtjM7pMk7knx83u1Qj8gzkicyelw==",
+ "version": "7.29.16",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.16.tgz",
+ "integrity": "sha512-LKBjGopxrQE0aFucNL69OyyyF143MOWUULEOftU3oCgyD35Sy84UUpVnt/sNvTb7ZmCyALSt7om+fojlW35zYQ==",
"license": "MIT",
"engines": {
"node": ">=6.9.0"
@@ -136,17 +136,17 @@
}
},
"node_modules/@babel/traverse": {
- "version": "7.29.14",
- "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.14.tgz",
- "integrity": "sha512-RAdQJrBgmIH1FWvN0X+1hoDxzMzlP4cv/1Zi4dn4tG1H0cTb+rw7CzUxQJhp1f4ANd8j5vH3fy8BAWFGkBDEsA==",
+ "version": "7.29.16",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.16.tgz",
+ "integrity": "sha512-a16ah9dTLOLUq5BL7NElJ7keefg/276vgfTfExDf1PizddYboqRnQXDTooVPb0VArIqrKe8KLlghnTxlZFEZtQ==",
"license": "MIT",
"dependencies": {
"@babel/code-frame": "^7.29.7",
- "@babel/generator": "^7.29.14",
+ "@babel/generator": "^7.29.16",
"@babel/helper-globals": "^7.29.7",
- "@babel/parser": "^7.29.14",
+ "@babel/parser": "^7.29.15",
"@babel/template": "^7.29.7",
- "@babel/types": "^7.29.14",
+ "@babel/types": "^7.29.15",
"debug": "^4.3.1"
},
"engines": {
@@ -154,12 +154,12 @@
}
},
"node_modules/@babel/types": {
- "version": "7.29.14",
- "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.14.tgz",
- "integrity": "sha512-UjI/dKmwJwT9pOszJitq2G6EObZPnsZUfdCr92z2TlF3EZK9J3EdfOKUrCzHl6wFthbzwhzl1Soc/UIwxRiq6w==",
+ "version": "7.29.15",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.15.tgz",
+ "integrity": "sha512-/XKpKDakL//LZ66bq1XsZOswuqeI5MZqPLDu18o3XdkU1fNJ7bdPtzgnc4ZNS+bBGHV0FJG8jjb8SwcC3nNVQQ==",
"license": "MIT",
"dependencies": {
- "@babel/helper-string-parser": "^7.29.14",
+ "@babel/helper-string-parser": "^7.29.15",
"@babel/helper-validator-identifier": "^7.29.7"
},
"engines": {
@@ -1198,12 +1198,12 @@
}
},
"node_modules/@thunderid/browser": {
- "version": "1.20.0",
- "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.20.0.tgz",
- "integrity": "sha512-M70Fw59j1uby6iECcbn6BP+NjjQ5qBIAu/vlexiMZoZAMAE2ZdfQUDuz6bwAZu+zcjOZoK92S7+mEN7JTDZpAA==",
+ "version": "1.27.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.27.0.tgz",
+ "integrity": "sha512-WLtyzL+vx8Z4faaw+CtVHTwaBUZj4MkZzmPpUVZLOQSYuV1b7zRiTTpUUhqkSG/TCMMg78gjDDQDGh2yTF4yqg==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.21.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"buffer": "6.0.3",
"core-js": "3.42.0",
@@ -1216,9 +1216,9 @@
}
},
"node_modules/@thunderid/javascript": {
- "version": "1.21.0",
- "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.21.0.tgz",
- "integrity": "sha512-p2tVpFv8S46BCX4smJ6z+aKuFxTB9IIAqbIbpj+5yDkpO5h7ePWZubXEyeB3MKQvhqhjNKxcMFTUjBE6N41FaQ==",
+ "version": "1.28.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.28.0.tgz",
+ "integrity": "sha512-IIJimiNPJCzFeDIw72tYwr2KkEE0vygvHt03DSTfsOoNp/nR0RjMyoP+BFh1+VRLGtb5DucdCJt1UnbnD/0bOw==",
"license": "Apache-2.0",
"dependencies": {
"jose": "6.2.3",
@@ -1226,13 +1226,13 @@
}
},
"node_modules/@thunderid/nextjs": {
- "version": "1.20.0",
- "resolved": "https://registry.npmjs.org/@thunderid/nextjs/-/nextjs-1.20.0.tgz",
- "integrity": "sha512-pAHhhDD+4TBdWfTyFll5U/FeeRt4DSIqKACbRODzczYpq5Byl14XSy4bBl1hmTe2gvpCclFSb+Yzs+JyqStvOw==",
+ "version": "1.25.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/nextjs/-/nextjs-1.25.0.tgz",
+ "integrity": "sha512-QS1Y17cxh2FGiIXERn1Jxg2geApzw61mbBIUcew8ZMaNOZNfEeGcPACCAm5cJ2HRlfGPPszOqfDttnE1kEp5Jg==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/node": "^1.18.0",
- "@thunderid/react": "^1.22.1",
+ "@thunderid/node": "^1.23.0",
+ "@thunderid/react": "^1.29.0",
"@types/react": "19.2.14",
"jose": "6.2.3",
"tslib": "2.8.1"
@@ -1243,14 +1243,14 @@
}
},
"node_modules/@thunderid/nextjs/node_modules/@thunderid/react": {
- "version": "1.22.1",
- "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.22.1.tgz",
- "integrity": "sha512-Kd75Mn0IedrTDEIb8mi9dEo+fh7WhbI0jcX7Mvf0LFaksMHxNVcoWHE6k9GJEB4kRfdtKOAEN9FH9emn1igWNw==",
+ "version": "1.29.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.29.0.tgz",
+ "integrity": "sha512-a4XX5xo+iruU2zrcQVwZuIOZ2tlzLMGRuVR+FykL04z5MEAwIvEq6UJxD2EImRwJGxDQ0W+ew5caypzyXIqJLA==",
"license": "Apache-2.0",
"dependencies": {
"@emotion/css": "11.13.5",
"@floating-ui/react": "0.27.12",
- "@thunderid/browser": "^1.19.0",
+ "@thunderid/browser": "^1.27.0",
"dompurify": "3.4.17",
"tslib": "2.8.1"
},
@@ -1289,12 +1289,12 @@
}
},
"node_modules/@thunderid/node": {
- "version": "1.18.0",
- "resolved": "https://registry.npmjs.org/@thunderid/node/-/node-1.18.0.tgz",
- "integrity": "sha512-6Njj8P5onKE3puipqcK8CD/t7hs0Uf5x2Fm+V+f+z8zJ/wxMzzacY4XU0jKl1rAKx2hLWbCnnV34a9pfEavcYg==",
+ "version": "1.23.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/node/-/node-1.23.0.tgz",
+ "integrity": "sha512-e+0ei7wsHjclKYjy0b70xtbALPUNVoA9UoXId3qpSPSoJ6SftBRLX257Dlkf/u6WjkemSYZ2EVOqFkqOMJ/+/Q==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.21.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"cross-fetch": "4.1.0",
"fast-sha256": "1.3.0",
@@ -3197,9 +3197,9 @@
}
},
"node_modules/string_decoder": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
- "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.4.0.tgz",
+ "integrity": "sha512-r8azg21Y67ckRmeG0hHol5CeDXMs4ZFkFT6eXMO39hX7khvJcopBcYTCeWZ0rQXkMoPh8lVdbjmsOMGL8krxRQ==",
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.2.0"
@@ -3273,9 +3273,9 @@
}
},
"node_modules/tabbable": {
- "version": "6.5.1",
- "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.5.1.tgz",
- "integrity": "sha512-dMCuwDUY6Noz3zVKLefBC4wq+aJV20yc7vWmM7uTNGwtQSFF5kX7OUIUsxuVajz/bdt5Xqdah3/0NLjth+cM5A==",
+ "version": "6.5.2",
+ "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.5.2.tgz",
+ "integrity": "sha512-XgdnB1nGU6KU4VgMnZPaZCx7M1hBrLyEiZYau2G2gq9UT0d7d4FUBlNX7vvPlm/B1vk1PjrzJBx9Lbv4fsqS9g==",
"license": "MIT"
},
"node_modules/tinyglobby": {
diff --git a/b2b/wayfinder-enterprise-nextjs/package.json b/b2b/wayfinder-enterprise-nextjs/package.json
index 98b8ad4..2eecafb 100644
--- a/b2b/wayfinder-enterprise-nextjs/package.json
+++ b/b2b/wayfinder-enterprise-nextjs/package.json
@@ -12,7 +12,7 @@
"start": "next start -p 3000"
},
"dependencies": {
- "@thunderid/nextjs": "1.20.0",
+ "@thunderid/nextjs": "latest",
"next": "16.4.5",
"react": "19.2.3",
"react-dom": "19.2.3",
diff --git a/integrations/better-auth-nextjs/package-lock.json b/integrations/better-auth-nextjs/package-lock.json
index 158bd90..d72b686 100644
--- a/integrations/better-auth-nextjs/package-lock.json
+++ b/integrations/better-auth-nextjs/package-lock.json
@@ -8,7 +8,7 @@
"name": "@thunderid/better-auth-nextjs-sample",
"version": "1.0.1",
"dependencies": {
- "@thunderid/better-auth": "0.1.1",
+ "@thunderid/better-auth": "latest",
"better-auth": "^1.7.18",
"next": "^15.5.29",
"react": "^19.2.9",
@@ -894,9 +894,9 @@
}
},
"node_modules/@thunderid/better-auth": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/@thunderid/better-auth/-/better-auth-0.1.1.tgz",
- "integrity": "sha512-A/uFdKc9YAKDgexVIW4V/1h46ytxYHyYHBBDdBf7h8T+E/fT/q8GZjFj7gRwj4VMXvRy1zHErhjXkDHAdawVkA==",
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/@thunderid/better-auth/-/better-auth-0.1.2.tgz",
+ "integrity": "sha512-h6M6brmPWP1a+AwwV9Sy+znQiFhjvVBiV5OiPBcRcrtVrr/XZ0u6zOf9lK7FZopLB7dLTrh+Y+lGSZ1bqkNM5A==",
"license": "Apache-2.0",
"peerDependencies": {
"better-auth": ">=1.7.0"
diff --git a/integrations/better-auth-nextjs/package.json b/integrations/better-auth-nextjs/package.json
index b280b2b..2a5bc41 100644
--- a/integrations/better-auth-nextjs/package.json
+++ b/integrations/better-auth-nextjs/package.json
@@ -9,7 +9,7 @@
"start": "next start"
},
"dependencies": {
- "@thunderid/better-auth": "0.1.1",
+ "@thunderid/better-auth": "latest",
"better-auth": "^1.7.18",
"next": "^15.5.29",
"react": "^19.2.9",
diff --git a/management/admin-react/package-lock.json b/management/admin-react/package-lock.json
index 315a016..1427123 100644
--- a/management/admin-react/package-lock.json
+++ b/management/admin-react/package-lock.json
@@ -9,15 +9,15 @@
"version": "1.0.1",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/react": "1.15.0",
- "@thunderid/react-router": "1.12.0",
+ "@thunderid/react": "latest",
+ "@thunderid/react-router": "latest",
"react": "19.2.9",
"react-dom": "19.2.9",
"react-router": "8.3.0"
},
"devDependencies": {
- "@thunderid/eslint-plugin": "1.0.1",
- "@thunderid/prettier-config": "1.0.1",
+ "@thunderid/eslint-plugin": "latest",
+ "@thunderid/prettier-config": "latest",
"@types/node": "24.7.2",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
@@ -1123,12 +1123,12 @@
"license": "MIT"
},
"node_modules/@thunderid/browser": {
- "version": "1.14.1",
- "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.14.1.tgz",
- "integrity": "sha512-CQ7FKhV1PQ+AxrVmqMBO3wi9pNpBYVvdysRL1XAeDMr1A15v8T6u8mr3D02GV+XSUE899BMMNjdFWYRO1IZZng==",
+ "version": "1.27.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.27.0.tgz",
+ "integrity": "sha512-WLtyzL+vx8Z4faaw+CtVHTwaBUZj4MkZzmPpUVZLOQSYuV1b7zRiTTpUUhqkSG/TCMMg78gjDDQDGh2yTF4yqg==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.15.1",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"buffer": "6.0.3",
"core-js": "3.42.0",
@@ -1175,9 +1175,9 @@
}
},
"node_modules/@thunderid/javascript": {
- "version": "1.15.1",
- "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.15.1.tgz",
- "integrity": "sha512-PrUG65S+V1vY9pLBt3gUMhhKTLCxqSN2C1Al3A9kaTJpHcLaqtW+SMPgGyZKbH8NsvhU9L3i4stRfi21QmR0lQ==",
+ "version": "1.28.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.28.0.tgz",
+ "integrity": "sha512-IIJimiNPJCzFeDIw72tYwr2KkEE0vygvHt03DSTfsOoNp/nR0RjMyoP+BFh1+VRLGtb5DucdCJt1UnbnD/0bOw==",
"license": "Apache-2.0",
"dependencies": {
"jose": "6.2.3",
@@ -1195,14 +1195,14 @@
}
},
"node_modules/@thunderid/react": {
- "version": "1.15.0",
- "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.15.0.tgz",
- "integrity": "sha512-UP1de+T0vvjMW/+rt5RrhHMeQp2DH0C3UNogZcWzb9JUSvuXHcN9hzUJefya+IxWVn/9UZexZRXXe/Lu808ywA==",
+ "version": "1.29.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.29.0.tgz",
+ "integrity": "sha512-a4XX5xo+iruU2zrcQVwZuIOZ2tlzLMGRuVR+FykL04z5MEAwIvEq6UJxD2EImRwJGxDQ0W+ew5caypzyXIqJLA==",
"license": "Apache-2.0",
"dependencies": {
"@emotion/css": "11.13.5",
"@floating-ui/react": "0.27.12",
- "@thunderid/browser": "^1.12.0",
+ "@thunderid/browser": "^1.27.0",
"dompurify": "3.4.17",
"tslib": "2.8.1"
},
@@ -1213,9 +1213,9 @@
}
},
"node_modules/@thunderid/react-router": {
- "version": "1.12.0",
- "resolved": "https://registry.npmjs.org/@thunderid/react-router/-/react-router-1.12.0.tgz",
- "integrity": "sha512-pAWSRT6QrCHQOi7QgGp+6YwCf1+2rWra9XYUFQpevbCootkSW+VT3nNhcwxZPBkltZMCIk3UguCE4Nwm/8XbIw==",
+ "version": "1.24.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/react-router/-/react-router-1.24.0.tgz",
+ "integrity": "sha512-HKfeZOqSjquKRDGZ2cZqRJTSK3ywnaD87Z+vx2ggcOzI8nhv3ZnwexiCLe/jtiZ5JRboweUIK8SfIoAn/TmW0A==",
"license": "Apache-2.0",
"dependencies": {
"tslib": "2.8.1"
diff --git a/management/admin-react/package.json b/management/admin-react/package.json
index edfbe0e..d1a971b 100644
--- a/management/admin-react/package.json
+++ b/management/admin-react/package.json
@@ -15,15 +15,15 @@
"format:fix": "prettier --write --cache ."
},
"dependencies": {
- "@thunderid/react": "1.15.0",
- "@thunderid/react-router": "1.12.0",
+ "@thunderid/react": "latest",
+ "@thunderid/react-router": "latest",
"react": "19.2.9",
"react-dom": "19.2.9",
"react-router": "8.3.0"
},
"devDependencies": {
- "@thunderid/eslint-plugin": "1.0.1",
- "@thunderid/prettier-config": "1.0.1",
+ "@thunderid/eslint-plugin": "latest",
+ "@thunderid/prettier-config": "latest",
"@types/node": "24.7.2",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
diff --git a/patterns/bff-react-express/README.md b/patterns/bff-react-express/README.md
index 9e4e328..c60e8e2 100644
--- a/patterns/bff-react-express/README.md
+++ b/patterns/bff-react-express/README.md
@@ -37,7 +37,9 @@ sequenceDiagram
The app and the BFF share one origin. In development the Vite dev server forwards `/api/auth` to the BFF, so the session cookie is first party and no CORS setup is needed.
-The BFF is stateful. The cookie holds only a session ID, and the tokens stay in the BFF's session store, which is what lets a back-channel logout end a session.
+The BFF is stateful. The cookie holds only an opaque session ID, and the tokens stay in the BFF's session store, which is what lets a back-channel logout end a session.
+
+The server is a few lines: `thunderID()` sets up the SDK, and `thunderIDBff()` from `@thunderid/express` serves every endpoint below. See [`server/index.mjs`](server/index.mjs).
## Prerequisites
@@ -90,7 +92,7 @@ npm install
npm run dev
```
-This starts the BFF on port 3001 and the React app on port 5173. Open [http://localhost:5173](http://localhost:5173) and sign in. The app never receives a refresh token or an ID token. The Token debug page shows the access token from `POST /api/auth/token`.
+This starts the BFF on port 3001 and the React app on port 5173. Open [http://localhost:5173](http://localhost:5173) and sign in. The app never receives a refresh token or an ID token. The Token debug page shows the access token from `POST /api/auth/token`, which the BFF serves only because the sample turns it on (see [Endpoints](#endpoints)).
## Use the BFF from a React app
@@ -108,23 +110,34 @@ Hooks and components work as they do without a BFF. Every SDK request carries `X
## Endpoints
-All under `/api/auth`. Every endpoint the browser SDK calls requires the `X-Requested-With: XMLHttpRequest` header, which a cross-site page cannot send without a CORS preflight, so the cookie cannot be used for cross-site request forgery.
+All under `/api/auth`, served by `thunderIDBff()`. Every response carries `Cache-Control: no-store`.
+
+Requests are checked before they reach an endpoint:
+
+- Every endpoint the browser SDK calls requires the `X-Requested-With: XMLHttpRequest` header, which a cross-site page cannot send without a CORS preflight. The exceptions are `GET /signin` and `GET /callback`, which the browser navigates to, `POST /backchannel-logout`, which ThunderID calls, and `GET /proxy/flow/meta`, the public sign-in UI metadata the SDK reads before sign-in.
+- The same endpoints refuse a request whose `Sec-Fetch-Site` header says it came from another origin or site.
+- A state-changing request, any method other than `GET`, `HEAD`, or `OPTIONS`, is refused when its `Origin` is not in the allowed origins. They default to the origin of `afterSignInUrl`, which is `APP_URL`. In development the Vite dev server forwards `/api/auth` without changing `Origin`, so the browser's `http://localhost:5173` matches. Pass `allowedOrigins` to `thunderIDBff()` to allow others.
| Endpoint | What it does |
|---|---|
-| `GET /signin` | Starts sign-in and comes back to the app path in `returnTo` |
+| `GET /signin` | Starts sign-in and comes back to the app path in `returnTo`. `ouId` signs in to an organization unit |
| `GET /callback` | The OAuth redirect URI. Exchanges the code and sets the session cookie |
-| `GET /session` | `{isSignedIn, user, expiresAt, scope}`. Refreshes an expired access token first |
+| `GET /session` | `{isSignedIn, user, expiresAt, scope}`, where `user` is the ID token's claims without the protocol claims. Refreshes an expired access token first |
| `GET /checksession` | `{isSignedIn}` only. Never refreshes, so the app can poll it |
-| `POST /refresh` | Refreshes the access token with the refresh token held here |
+| `POST /refresh` | Refreshes the access token with the refresh token held here. `204`, or `401 login_required` |
| `POST /signout` | Ends the BFF session and returns `{redirectUrl}`, the ThunderID end-session URL |
-| `POST /token` | The access token, without the refresh token, for APIs the app calls directly |
-| `ALL /proxy/*` | Forwards to `API_BASE_URL` with `Authorization: Bearer`. `401 login_required` when the session is gone |
+| `POST /switch` | Switches the session to the organization unit in `ouId` without a redirect, using the device secret. `interaction_required` when that is not possible |
| `POST /backchannel-logout` | Receives ThunderID's logout token and deletes the session it names |
+| `ALL /proxy/*` | Forwards to `API_BASE_URL` with `Authorization: Bearer`. `401 login_required` when the session is gone, `400 invalid_path` for a path outside the API, `502 bad_gateway` when the API cannot be reached |
+| `POST /token` | Off by default. The access token, without the refresh token, for APIs the app calls directly (`endpoints.backend.bypass`) |
+
+Any other path answers `404 not_found`, and a failure inside the BFF `500 server_error`.
+
+`POST /token` is the token-mediating pattern: the browser holds an access token, which a script injected into the page could read. This sample turns it on with `thunderIDBff({exposeAccessToken: true})` for its Token debug page. It is optional. Leave the option out, and call APIs through `/api/auth/proxy`, to keep every token on the server.
## Back-channel logout
-When the user's ThunderID session ends anywhere else, ThunderID posts a signed logout token to `/api/auth/backchannel-logout`. The SDK's `handleBackchannelLogout()` checks the signature, issuer, audience, and replay, then deletes the BFF session that joined the ended ThunderID session. The React app finds out the next time it asks `/api/auth/checksession`, or on its next API call, and signs the user out.
+When the user's ThunderID session ends anywhere else, ThunderID posts a signed logout token to `/api/auth/backchannel-logout`. The SDK checks the signature, issuer, audience, and replay, then deletes the BFF session that joined the ended ThunderID session. The React app finds out the next time it asks `/api/auth/checksession`, or on its next API call, and signs the user out.
To try it:
@@ -143,7 +156,8 @@ To try it:
## Going to production
-- Serve the React build and the BFF from the same origin, for example behind one reverse proxy, and set `APP_URL` to it. With `https`, the session cookie is marked `Secure`.
+- Serve the React build and the BFF from the same origin, over HTTPS, for example behind one reverse proxy, and set `APP_URL` to it.
+- Run the BFF with `NODE_ENV=production`. The session cookie is then `Secure` and named with the `__Host-Http-` prefix, so browsers send it only over HTTPS, and page script cannot set it. Over plain HTTP, sign-in never sticks.
- Remove `NODE_TLS_REJECT_UNAUTHORIZED=0`.
- The SDK keeps sessions in memory, so restarting the BFF signs everyone out. With more than one BFF instance, give the SDK a shared store, since ThunderID's back-channel request reaches only one of them.
diff --git a/patterns/bff-react-express/client/package.json b/patterns/bff-react-express/client/package.json
index ce5a011..8a64a8b 100644
--- a/patterns/bff-react-express/client/package.json
+++ b/patterns/bff-react-express/client/package.json
@@ -9,8 +9,8 @@
"preview": "vite preview"
},
"dependencies": {
- "@thunderid/react": "1.11.3",
- "@thunderid/react-router": "1.10.3",
+ "@thunderid/react": "latest",
+ "@thunderid/react-router": "latest",
"react": "^19.2.9",
"react-dom": "^19.2.9",
"react-router": "^7.18.2"
diff --git a/patterns/bff-react-express/package-lock.json b/patterns/bff-react-express/package-lock.json
index db1c996..547603c 100644
--- a/patterns/bff-react-express/package-lock.json
+++ b/patterns/bff-react-express/package-lock.json
@@ -19,8 +19,8 @@
"name": "@thunderid/bff-react-express-client",
"version": "0.0.1",
"dependencies": {
- "@thunderid/react": "1.11.3",
- "@thunderid/react-router": "1.10.3",
+ "@thunderid/react": "latest",
+ "@thunderid/react-router": "latest",
"react": "^19.2.9",
"react-dom": "^19.2.9",
"react-router": "^7.18.2"
@@ -1392,12 +1392,12 @@
"link": true
},
"node_modules/@thunderid/browser": {
- "version": "1.9.3",
- "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.9.3.tgz",
- "integrity": "sha512-UWf434pfeQF/OmzEU7tZvs9koEcfTkbvR8Mnx6xLbw/uG5Vof7MaXfD5YRU0GJ5yCkOQ801XP95Mg7mrQbEc4w==",
+ "version": "1.27.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.27.0.tgz",
+ "integrity": "sha512-WLtyzL+vx8Z4faaw+CtVHTwaBUZj4MkZzmPpUVZLOQSYuV1b7zRiTTpUUhqkSG/TCMMg78gjDDQDGh2yTF4yqg==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.10.3",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"buffer": "6.0.3",
"core-js": "3.42.0",
@@ -1416,12 +1416,12 @@
"license": "0BSD"
},
"node_modules/@thunderid/express": {
- "version": "1.9.3",
- "resolved": "https://registry.npmjs.org/@thunderid/express/-/express-1.9.3.tgz",
- "integrity": "sha512-D9YqfdgYm33153H1XlYcm3fQMp5Z0x+xtQzzVsp4nzk6SPUSmV4BbLBVArgICCT2DfTtUDOuiWzzVm1xJ0XARg==",
+ "version": "1.22.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/express/-/express-1.22.0.tgz",
+ "integrity": "sha512-X9S5p0CqfPO9oIuHi7jFTpjCU82u5JTJKAadVVsXDRnmudaQ7tL66sPhl3BpQj5JxIRXiX4xSGa+Y+2Kp9VwMA==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/node": "^1.9.3",
+ "@thunderid/node": "^1.23.0",
"uuid": "11.1.1"
},
"peerDependencies": {
@@ -1429,9 +1429,9 @@
}
},
"node_modules/@thunderid/javascript": {
- "version": "1.10.3",
- "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.10.3.tgz",
- "integrity": "sha512-tSnoN6bevG94PCxFGNMXuOCDxIUhLJwwuiLu3bn37cZy+2cd6nWwAGUzZOR7bvWjFyuERw0l3qNgGViO26JW8A==",
+ "version": "1.28.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.28.0.tgz",
+ "integrity": "sha512-IIJimiNPJCzFeDIw72tYwr2KkEE0vygvHt03DSTfsOoNp/nR0RjMyoP+BFh1+VRLGtb5DucdCJt1UnbnD/0bOw==",
"license": "Apache-2.0",
"dependencies": {
"jose": "6.2.3",
@@ -1445,12 +1445,12 @@
"license": "0BSD"
},
"node_modules/@thunderid/node": {
- "version": "1.9.3",
- "resolved": "https://registry.npmjs.org/@thunderid/node/-/node-1.9.3.tgz",
- "integrity": "sha512-TRr4HTGWaS4ozY1Mnr13/Ban/xriCS/+k4buVDujkqoCwmx9FzgOCNeub+k6zJWElw/moQQJGMhUBtKDARJ6IQ==",
+ "version": "1.23.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/node/-/node-1.23.0.tgz",
+ "integrity": "sha512-e+0ei7wsHjclKYjy0b70xtbALPUNVoA9UoXId3qpSPSoJ6SftBRLX257Dlkf/u6WjkemSYZ2EVOqFkqOMJ/+/Q==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.10.3",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"cross-fetch": "4.1.0",
"fast-sha256": "1.3.0",
@@ -1468,14 +1468,14 @@
"license": "0BSD"
},
"node_modules/@thunderid/react": {
- "version": "1.11.3",
- "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.11.3.tgz",
- "integrity": "sha512-gj16oE2oRxrOnG6Lo4lz2mRHcjkPwk2KiB5RFi/7JQuEWJb8xFN/nHQau0YE283C0Ffiyen2kzVamXZJiyLoPw==",
+ "version": "1.29.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.29.0.tgz",
+ "integrity": "sha512-a4XX5xo+iruU2zrcQVwZuIOZ2tlzLMGRuVR+FykL04z5MEAwIvEq6UJxD2EImRwJGxDQ0W+ew5caypzyXIqJLA==",
"license": "Apache-2.0",
"dependencies": {
"@emotion/css": "11.13.5",
"@floating-ui/react": "0.27.12",
- "@thunderid/browser": "^1.9.3",
+ "@thunderid/browser": "^1.27.0",
"dompurify": "3.4.17",
"tslib": "2.8.1"
},
@@ -1486,9 +1486,9 @@
}
},
"node_modules/@thunderid/react-router": {
- "version": "1.10.3",
- "resolved": "https://registry.npmjs.org/@thunderid/react-router/-/react-router-1.10.3.tgz",
- "integrity": "sha512-a1gviViT/AXT6S1DZRBIN9q5e12boEm/I4/c5IUvDGxWo0lgKfOdJ4p+QPgiSAWoCvIgfSeA40gS/bBwrE4N/A==",
+ "version": "1.24.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/react-router/-/react-router-1.24.0.tgz",
+ "integrity": "sha512-HKfeZOqSjquKRDGZ2cZqRJTSK3ywnaD87Z+vx2ggcOzI8nhv3ZnwexiCLe/jtiZ5JRboweUIK8SfIoAn/TmW0A==",
"license": "Apache-2.0",
"dependencies": {
"tslib": "2.8.1"
@@ -3905,7 +3905,7 @@
"name": "@thunderid/bff-react-express-server",
"version": "0.0.1",
"dependencies": {
- "@thunderid/express": "1.9.3",
+ "@thunderid/express": "latest",
"cookie-parser": "^1.4.7",
"express": "^5.3.0"
}
diff --git a/patterns/bff-react-express/server/index.mjs b/patterns/bff-react-express/server/index.mjs
index 43141ca..fa17369 100644
--- a/patterns/bff-react-express/server/index.mjs
+++ b/patterns/bff-react-express/server/index.mjs
@@ -1,7 +1,6 @@
import express from 'express';
import cookieParser from 'cookie-parser';
-import {thunderID, handleBackchannelLogout} from '@thunderid/express';
-import {createProxy, createPublicProxy} from './lib/proxy.mjs';
+import {thunderID, thunderIDBff} from '@thunderid/express';
const port = Number(process.env.PORT) || 3001;
const baseUrl = process.env.THUNDERID_BASE_URL || 'https://localhost:8090';
@@ -14,9 +13,6 @@ const apiBaseUrl = (process.env.API_BASE_URL || baseUrl).replace(/\/+$/, '');
const REQUIRED_ENV_VARS = ['THUNDERID_CLIENT_ID', 'THUNDERID_CLIENT_SECRET'];
const missingEnvVars = REQUIRED_ENV_VARS.filter((key) => !process.env[key]);
-const RETURN_TO_COOKIE = 'thunderid_bff_return_to';
-const secureCookies = appUrl.startsWith('https:');
-
const app = express();
app.disable('x-powered-by');
app.use(cookieParser());
@@ -27,17 +23,9 @@ app.get('/', (_req, res) => {
});
});
-const auth = express.Router();
-app.use('/api/auth', auth);
-
-// Session responses carry user data and tokens, so nothing here may be cached.
-auth.use((_req, res, next) => {
- res.set('Cache-Control', 'no-store');
- next();
-});
-
if (missingEnvVars.length > 0) {
- auth.use((_req, res) => {
+ app.use('/api/auth', (_req, res) => {
+ res.set('Cache-Control', 'no-store');
res.status(503).json({
error: 'not_configured',
message: 'Copy .env.example to .env, fill in the values from your ThunderID application, then restart the BFF.',
@@ -45,216 +33,38 @@ if (missingEnvVars.length > 0) {
});
});
} else {
- auth.use(
+ app.use(
thunderID({
baseUrl,
clientId: process.env.THUNDERID_CLIENT_ID,
clientSecret: process.env.THUNDERID_CLIENT_SECRET,
// The redirect URI sent to ThunderID. It is on the app's origin so that the session cookie set
// by the callback belongs to the app, and must be registered for the application as it is.
+ // Its origin is also the only origin the BFF accepts state-changing calls from.
afterSignInUrl: `${appUrl}/api/auth/callback`,
// The post-logout redirect URI, also registered for the application.
afterSignOutUrl: appUrl,
- sessionCookie: {httpOnly: true, sameSite: 'lax', secure: secureCookies},
onBackchannelLogout: ({sessionsEnded, sid}) => {
console.log(`Back-channel logout for ThunderID session ${sid ?? '(by subject)'}: ended ${sessionsEnded} local session(s).`);
},
}),
);
-}
-
-/** The BFF session ID from the request's cookie, which keys the tokens the SDK stores. */
-const sessionIdOf = (req) => req.cookies?.[req.thunderIDAuth.getSessionCookieName()];
-/**
- * Returns the request's session ID when the session is signed in, or answers `401 login_required`.
- * The SDK refreshes an expired access token here with the refresh token, so the browser never has
- * to. When the refresh fails, the session is gone and the browser has to sign in again.
- */
-async function requireSession(req, res) {
- const sessionId = sessionIdOf(req);
- if (sessionId && (await req.thunderIDAuth.isSignedIn(sessionId))) {
- return sessionId;
- }
- res.status(401).json({error: 'login_required'});
- return undefined;
-}
-
-/** Only a path on the app itself is a valid place to return to after sign-in. */
-function safeReturnTo(value) {
- return typeof value === 'string' && /^\/(?![/\\])/.test(value) ? value : '/';
+ // Serves the whole BFF contract under /api/auth: sign-in, the callback, the session, refresh,
+ // sign-out, organization unit switch, back-channel logout, and the API proxy, which forwards
+ // /api/auth/proxy/ to / with the session's access token.
+ app.use(
+ thunderIDBff({
+ apiBaseUrl,
+ // Turns on POST /api/auth/token, which hands the browser the access token (never the refresh
+ // token) for APIs it calls directly instead of through the proxy. This is the token-mediating
+ // pattern, and it is optional: the app's Token debug page uses it. Leave it out to keep every
+ // token on the server.
+ exposeAccessToken: true,
+ }),
+ );
}
-/**
- * Claims that only matter for validating the ID token, left out of the session's `user`. The time
- * claims `auth_time`, `iat`, and `exp` stay, since the React SDK's `getDecodedIdToken()` returns
- * `user` in BFF mode and apps read them to show when the user signed in.
- */
-const PROTOCOL_CLAIMS = ['acr', 'amr', 'at_hash', 'aud', 'azp', 'c_hash', 'iss', 'jti', 'nbf', 'nonce', 'sid'];
-
-// ── Endpoints the browser navigates to ──────────────────────────────────
-
-// Starts sign-in. The browser SDK navigates here with the path to come back to.
-auth.get('/signin', async (req, res) => {
- res.cookie(RETURN_TO_COOKIE, safeReturnTo(req.query.returnTo), {
- httpOnly: true,
- maxAge: 10 * 60 * 1000,
- path: '/api/auth',
- sameSite: 'lax',
- secure: secureCookies,
- });
-
- try {
- // Redirects to ThunderID with an authorization code request and PKCE. A session that is already
- // signed in comes straight back with its tokens instead.
- const tokens = await req.thunderIDAuth.signIn(req, res);
- if (tokens.accessToken && !res.headersSent) {
- res.redirect(`${appUrl}${safeReturnTo(req.query.returnTo)}`);
- }
- } catch (error) {
- console.error('Could not start sign-in.', error);
- res.status(500).json({error: 'signin_failed'});
- }
-});
-
-// ThunderID redirects here with the authorization code. The tokens stay in the BFF, and the browser
-// gets only the HttpOnly session cookie.
-auth.get('/callback', async (req, res) => {
- const returnTo = safeReturnTo(req.cookies?.[RETURN_TO_COOKIE]);
- res.clearCookie(RETURN_TO_COOKIE, {path: '/api/auth'});
-
- if (req.query.error) {
- console.warn(`Sign-in failed at ThunderID: ${req.query.error}`);
- res.redirect(appUrl);
- return;
- }
-
- try {
- await req.thunderIDAuth.signIn(req, res);
- res.redirect(`${appUrl}${returnTo}`);
- } catch (error) {
- console.error('Could not complete sign-in.', error);
- res.status(500).json({error: 'signin_failed'});
- }
-});
-
-// ThunderID posts a logout token here, server to server, when the user's ThunderID session ends
-// anywhere else: a sign-out from another application, an administrator ending the session, or the
-// user being deleted. The SDK validates the token and deletes the BFF session it names. The browser
-// finds out on its next check of /checksession or its next proxied call, and the React SDK signs
-// the app out. Register `/api/auth/backchannel-logout` as the Back-Channel Logout URI.
-auth.post('/backchannel-logout', handleBackchannelLogout());
-
-// Public, read-only API calls the browser SDK makes before sign-in, such as `/flow/meta`.
-auth.use('/proxy', createPublicProxy({apiBaseUrl}));
-
-// ── Endpoints the browser SDK calls ─────────────────────────────────────
-
-// Every call from here on must carry `X-Requested-With`. A page on another origin cannot add the
-// header without a CORS preflight, which this server never answers, so the session cookie cannot
-// be used by a cross-site request.
-auth.use((req, res, next) => {
- if (req.get('X-Requested-With') !== 'XMLHttpRequest') {
- res.status(403).json({error: 'forbidden', message: 'Missing the X-Requested-With: XMLHttpRequest header.'});
- return;
- }
- next();
-});
-
-// The signed-in user, when the access token expires, and the scopes it was granted.
-auth.get('/session', async (req, res) => {
- const client = req.thunderIDAuth;
- const sessionId = sessionIdOf(req);
-
- if (!sessionId || !(await client.isSignedIn(sessionId))) {
- res.json({isSignedIn: false});
- return;
- }
-
- const claims = await client.getDecodedIdToken(sessionId);
- const session = await client.getStorageManager().getSessionData(sessionId);
- const user = Object.fromEntries(Object.entries(claims).filter(([claim]) => !PROTOCOL_CLAIMS.includes(claim)));
-
- res.json({
- isSignedIn: true,
- user,
- expiresAt: Math.floor((session.created_at + Number(session.expires_in) * 1000) / 1000),
- scope: session.scope,
- });
-});
-
-// Whether the session still exists. The browser SDK polls this, so it must not refresh the session
-// or count as activity. A back-channel logout deletes the session, and the next poll reports it.
-auth.get('/checksession', async (req, res) => {
- const sessionId = sessionIdOf(req);
- const isSignedIn = Boolean(sessionId && (await req.thunderIDAuth.getAccessToken(sessionId)));
-
- res.json({isSignedIn});
-});
-
-// Refreshes the session's access token with the refresh token held here.
-auth.post('/refresh', async (req, res) => {
- const sessionId = sessionIdOf(req);
-
- try {
- if (!sessionId) {
- throw new Error('No session cookie.');
- }
- await req.thunderIDAuth.refreshAccessToken(sessionId);
- res.status(204).end();
- } catch {
- res.status(401).json({error: 'login_required'});
- }
-});
-
-// Ends the BFF session and returns the ThunderID end-session URL, which the browser then visits so
-// the ThunderID session ends too. ThunderID then sends a back-channel logout to every other
-// application that took part in the session.
-auth.post('/signout', async (req, res) => {
- const client = req.thunderIDAuth;
- const sessionId = sessionIdOf(req);
-
- res.clearCookie(client.getSessionCookieName());
- if (!sessionId) {
- res.json({redirectUrl: appUrl});
- return;
- }
-
- try {
- // Built before the session is cleared, so it carries the ID token as id_token_hint.
- const redirectUrl = await client.signOut(sessionId);
- client.clearSession(sessionId);
- res.json({redirectUrl});
- } catch (error) {
- console.error('Could not sign out.', error);
- res.status(500).json({error: 'signout_failed'});
- }
-});
-
-// The access token, for requests the browser sends straight to an API instead of through the proxy
-// (`endpoints.backend.bypass`). The refresh token never leaves the BFF.
-auth.post('/token', async (req, res) => {
- const sessionId = await requireSession(req, res);
- if (!sessionId) return;
-
- const session = await req.thunderIDAuth.getStorageManager().getSessionData(sessionId);
- const expiresAt = session.created_at + Number(session.expires_in) * 1000;
-
- res.json({
- access_token: session.access_token,
- token_type: 'Bearer',
- expires_in: Math.max(0, Math.floor((expiresAt - Date.now()) / 1000)),
- scope: session.scope,
- });
-});
-
-// Forwards /api/auth/proxy/ to / with the session's access token.
-auth.use('/proxy', createProxy({apiBaseUrl, requireSession}));
-
-auth.use((_req, res) => {
- res.status(404).json({error: 'not_found'});
-});
-
app.listen(port, () => {
console.log(`ThunderID BFF running on http://localhost:${port}`);
if (missingEnvVars.length > 0) {
diff --git a/patterns/bff-react-express/server/lib/proxy.mjs b/patterns/bff-react-express/server/lib/proxy.mjs
deleted file mode 100644
index b8e0ee4..0000000
--- a/patterns/bff-react-express/server/lib/proxy.mjs
+++ /dev/null
@@ -1,88 +0,0 @@
-import express from 'express';
-
-/** Request headers passed on to the API. Cookies and the CSRF header stay at the BFF. */
-const FORWARDED_REQUEST_HEADERS = ['accept', 'accept-language', 'content-type', 'if-match', 'if-none-match'];
-
-/** Response headers passed back to the browser. */
-const FORWARDED_RESPONSE_HEADERS = ['content-type', 'etag', 'last-modified', 'location', 'www-authenticate'];
-
-/**
- * API paths the proxy forwards without a session or a token. The React SDK reads the sign-in UI's
- * translations and branding from `/flow/meta` before anyone signs in, with a plain `fetch` that
- * sends no `X-Requested-With` header. The endpoint is public and read only.
- */
-const PUBLIC_PATHS = ['/flow/meta'];
-
-/**
- * Forwards a GET to one of the public paths without a token. Mount it ahead of the CSRF check.
- */
-export function createPublicProxy({apiBaseUrl}) {
- return (req, res, next) => {
- if (req.method !== 'GET' || !PUBLIC_PATHS.includes(req.path)) {
- next();
- return;
- }
- void forward(req, res, `${apiBaseUrl}${req.url}`, {});
- };
-}
-
-/** Sends the request on to the API and the API's answer back to the browser. */
-async function forward(req, res, target, headers) {
- FORWARDED_REQUEST_HEADERS.forEach((name) => {
- const value = req.get(name);
- if (value) headers[name] = value;
- });
-
- const hasBody = !['GET', 'HEAD'].includes(req.method) && Buffer.isBuffer(req.body) && req.body.length > 0;
-
- let upstream;
- try {
- upstream = await fetch(target, {
- method: req.method,
- headers,
- body: hasBody ? req.body : undefined,
- redirect: 'manual',
- });
- } catch (error) {
- console.error(`Could not reach the API at ${new URL(target).origin}.`, error);
- res.status(502).json({error: 'bad_gateway'});
- return;
- }
-
- res.status(upstream.status);
- FORWARDED_RESPONSE_HEADERS.forEach((name) => {
- const value = upstream.headers.get(name);
- if (value) res.set(name, value);
- });
- res.send(Buffer.from(await upstream.arrayBuffer()));
-}
-
-/**
- * The BFF's API proxy. A request to `/` is sent to `/` with the
- * session's access token as `Authorization: Bearer`, and the API's answer is sent back as it is.
- * The browser never sees the token.
- *
- * A `401` from the API is passed through unchanged. The browser SDK treats it as the API's answer,
- * and only the BFF's own `401 login_required` signs the app out.
- */
-export function createProxy({apiBaseUrl, requireSession}) {
- const router = express.Router();
-
- router.use(express.raw({type: () => true, limit: '1mb'}), async (req, res) => {
- const sessionId = await requireSession(req, res);
- if (!sessionId) return;
-
- // `new URL` resolves any `..` in the path, so check the result is still under the API.
- const target = new URL(`${apiBaseUrl}${req.url}`);
- if (target.href !== apiBaseUrl && !target.href.startsWith(`${apiBaseUrl}/`) && !target.href.startsWith(`${apiBaseUrl}?`)) {
- res.status(400).json({error: 'invalid_path'});
- return;
- }
-
- await forward(req, res, target.href, {
- authorization: `Bearer ${await req.thunderIDAuth.getAccessToken(sessionId)}`,
- });
- });
-
- return router;
-}
diff --git a/patterns/bff-react-express/server/package.json b/patterns/bff-react-express/server/package.json
index 295f7fd..c8e6a74 100644
--- a/patterns/bff-react-express/server/package.json
+++ b/patterns/bff-react-express/server/package.json
@@ -8,7 +8,7 @@
"dev": "node --env-file-if-exists=.env --watch index.mjs"
},
"dependencies": {
- "@thunderid/express": "1.9.3",
+ "@thunderid/express": "latest",
"cookie-parser": "^1.4.7",
"express": "^5.3.0"
}
diff --git a/quickstarts/quickstart-browser/package-lock.json b/quickstarts/quickstart-browser/package-lock.json
index 7442eae..7c20b36 100644
--- a/quickstarts/quickstart-browser/package-lock.json
+++ b/quickstarts/quickstart-browser/package-lock.json
@@ -8,7 +8,7 @@
"name": "@thunderid/quickstart-browser-sample",
"version": "1.0.1",
"dependencies": {
- "@thunderid/browser": "1.3.0"
+ "@thunderid/browser": "latest"
},
"devDependencies": {
"vite": "^6.3.5"
@@ -866,12 +866,12 @@
]
},
"node_modules/@thunderid/browser": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.3.0.tgz",
- "integrity": "sha512-O6DHlUyVFfBaNcJDEXACLU4NJMrNjDlqAuzesvJ+8a0Gl5g8WFK53rpx027e/rWICG0vcGe2UVZuhvZq5Z511A==",
+ "version": "1.27.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.27.0.tgz",
+ "integrity": "sha512-WLtyzL+vx8Z4faaw+CtVHTwaBUZj4MkZzmPpUVZLOQSYuV1b7zRiTTpUUhqkSG/TCMMg78gjDDQDGh2yTF4yqg==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.4.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"buffer": "6.0.3",
"core-js": "3.42.0",
@@ -884,9 +884,9 @@
}
},
"node_modules/@thunderid/javascript": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.4.0.tgz",
- "integrity": "sha512-qHfIFzXOQTN1nhuBT91Tr8bLPvfyEDa7gUQSL7GNcJkcyyKfJ77meIwr91lCme0ySFUnTeKl0Bk+R8iIJiKXBw==",
+ "version": "1.28.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.28.0.tgz",
+ "integrity": "sha512-IIJimiNPJCzFeDIw72tYwr2KkEE0vygvHt03DSTfsOoNp/nR0RjMyoP+BFh1+VRLGtb5DucdCJt1UnbnD/0bOw==",
"license": "Apache-2.0",
"dependencies": {
"jose": "6.2.3",
diff --git a/quickstarts/quickstart-browser/package.json b/quickstarts/quickstart-browser/package.json
index 9542113..556e8e1 100644
--- a/quickstarts/quickstart-browser/package.json
+++ b/quickstarts/quickstart-browser/package.json
@@ -10,7 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
- "@thunderid/browser": "1.3.0"
+ "@thunderid/browser": "latest"
},
"devDependencies": {
"vite": "^6.3.5"
diff --git a/quickstarts/quickstart-express/package-lock.json b/quickstarts/quickstart-express/package-lock.json
index 6575e12..58f800d 100644
--- a/quickstarts/quickstart-express/package-lock.json
+++ b/quickstarts/quickstart-express/package-lock.json
@@ -8,18 +8,18 @@
"name": "@thunderid/quickstart-express-sample",
"version": "1.0.1",
"dependencies": {
- "@thunderid/express": "1.3.0",
+ "@thunderid/express": "latest",
"cookie-parser": "^1.4.7",
"express": "^4.21.2"
}
},
"node_modules/@thunderid/express": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@thunderid/express/-/express-1.3.0.tgz",
- "integrity": "sha512-CF+XvS3rRr891Vf3PVi+6iS20NfMg4F3j2hcrLe7GSXrnDzknwTT4t5SS7JsH0JNRozcCxoZA0ayFXzfrMh40Q==",
+ "version": "1.22.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/express/-/express-1.22.0.tgz",
+ "integrity": "sha512-X9S5p0CqfPO9oIuHi7jFTpjCU82u5JTJKAadVVsXDRnmudaQ7tL66sPhl3BpQj5JxIRXiX4xSGa+Y+2Kp9VwMA==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/node": "^1.3.0",
+ "@thunderid/node": "^1.23.0",
"uuid": "11.1.1"
},
"peerDependencies": {
@@ -27,9 +27,9 @@
}
},
"node_modules/@thunderid/javascript": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.4.0.tgz",
- "integrity": "sha512-qHfIFzXOQTN1nhuBT91Tr8bLPvfyEDa7gUQSL7GNcJkcyyKfJ77meIwr91lCme0ySFUnTeKl0Bk+R8iIJiKXBw==",
+ "version": "1.28.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.28.0.tgz",
+ "integrity": "sha512-IIJimiNPJCzFeDIw72tYwr2KkEE0vygvHt03DSTfsOoNp/nR0RjMyoP+BFh1+VRLGtb5DucdCJt1UnbnD/0bOw==",
"license": "Apache-2.0",
"dependencies": {
"jose": "6.2.3",
@@ -37,12 +37,12 @@
}
},
"node_modules/@thunderid/node": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@thunderid/node/-/node-1.3.0.tgz",
- "integrity": "sha512-hAFf4Bv3JZTcatF7Y/iarbd3lYLbIkz6SHzGKG5HOwh/a/Ip8qpu7u4npF6/0cNzrvZzY5g6awIymsIav75Xqw==",
+ "version": "1.23.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/node/-/node-1.23.0.tgz",
+ "integrity": "sha512-e+0ei7wsHjclKYjy0b70xtbALPUNVoA9UoXId3qpSPSoJ6SftBRLX257Dlkf/u6WjkemSYZ2EVOqFkqOMJ/+/Q==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.4.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"cross-fetch": "4.1.0",
"fast-sha256": "1.3.0",
diff --git a/quickstarts/quickstart-express/package.json b/quickstarts/quickstart-express/package.json
index 01c3bca..5bf0b67 100644
--- a/quickstarts/quickstart-express/package.json
+++ b/quickstarts/quickstart-express/package.json
@@ -9,7 +9,7 @@
"dev": "node --env-file-if-exists=.env --watch index.mjs"
},
"dependencies": {
- "@thunderid/express": "1.3.0",
+ "@thunderid/express": "latest",
"cookie-parser": "^1.4.7",
"express": "^4.21.2"
},
diff --git a/quickstarts/quickstart-nextjs-b2b/.env.example b/quickstarts/quickstart-nextjs-b2b/.env.example
index 2500611..5c1384f 100644
--- a/quickstarts/quickstart-nextjs-b2b/.env.example
+++ b/quickstarts/quickstart-nextjs-b2b/.env.example
@@ -20,8 +20,8 @@ NEXT_PUBLIC_THUNDERID_SCOPES=openid profile email roles ou org device_sso
# ID of the sign-in flow the import creates. A company admin sets the flow's enterpriseIdp variable for their company.
NEXT_PUBLIC_THUNDERID_SIGN_IN_FLOW_ID=019f0b20-0000-7000-8000-000000000021
-# Signs the session cookie. Generate it with `openssl rand -base64 32`.
-THUNDERID_SECRET=
+# Encrypts the session cookie. At least 32 bytes; generate it with `openssl rand -base64 32`.
+THUNDERID_SESSION_SECRET=
# DANGER: Disables ALL TLS verification. Only for local development with self-signed certs. NEVER use in production.
NODE_TLS_REJECT_UNAUTHORIZED=0
diff --git a/quickstarts/quickstart-nextjs-b2b/README.md b/quickstarts/quickstart-nextjs-b2b/README.md
index f0d1fed..8652def 100644
--- a/quickstarts/quickstart-nextjs-b2b/README.md
+++ b/quickstarts/quickstart-nextjs-b2b/README.md
@@ -62,7 +62,7 @@ The import replaces the `defaultResourceServer` setting, which only the Control
cp .env.example .env
```
-Set `THUNDERID_CLIENT_SECRET` to the client secret you set as `NEXTJS_B2B_CLIENT_SECRET`, and `THUNDERID_SECRET` to a long random string, for example from `openssl rand -base64 32`. The other defaults match the import.
+Set `THUNDERID_CLIENT_SECRET` to the client secret you set as `NEXTJS_B2B_CLIENT_SECRET`, and `THUNDERID_SESSION_SECRET` to a random value of at least 32 bytes, for example from `openssl rand -base64 32`. The other defaults match the import.
| Variable | Description |
|---|---|
@@ -72,7 +72,7 @@ Set `THUNDERID_CLIENT_SECRET` to the client secret you set as `NEXTJS_B2B_CLIENT
| `NEXT_PUBLIC_THUNDERID_AFTER_SIGN_OUT_URL` | Where ThunderID returns the browser after sign-out |
| `NEXT_PUBLIC_THUNDERID_SCOPES` | `ou` and `roles` put the company and the roles held there into the tokens. `org` asks for the permission a company admin needs. `device_sso` asks for a device secret, which the server uses to switch companies. |
| `NEXT_PUBLIC_THUNDERID_SIGN_IN_FLOW_ID` | ID of the sign-in flow, whose `enterpriseIdp` variable a company admin sets |
-| `THUNDERID_SECRET` | Signs the session cookie |
+| `THUNDERID_SESSION_SECRET` | Encrypts the session cookie. At least 32 bytes, which production requires. |
| `NODE_TLS_REJECT_UNAUTHORIZED` | Set to `0` in the example to accept a local server's self-signed certificate. Local development only. |
## Run
diff --git a/quickstarts/quickstart-nextjs-b2b/package-lock.json b/quickstarts/quickstart-nextjs-b2b/package-lock.json
index ad37899..ce4f78e 100644
--- a/quickstarts/quickstart-nextjs-b2b/package-lock.json
+++ b/quickstarts/quickstart-nextjs-b2b/package-lock.json
@@ -8,7 +8,7 @@
"name": "@thunderid/quickstart-nextjs-b2b-sample",
"version": "0.0.1",
"dependencies": {
- "@thunderid/nextjs": "1.20.0",
+ "@thunderid/nextjs": "latest",
"next": "16.4.5",
"react": "19.2.3",
"react-dom": "19.2.3"
@@ -35,13 +35,13 @@
}
},
"node_modules/@babel/generator": {
- "version": "7.29.14",
- "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.14.tgz",
- "integrity": "sha512-qSY56jgW5JnSXzuekLVil6zaOQxOCtOHidr65KkaMBw772IuAY28Qx4ZykAcDn8+FRF15qk80XzKwgSc/RYW6g==",
+ "version": "7.29.16",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.16.tgz",
+ "integrity": "sha512-yRtddtrcYdLJt0l70aP7usb2YpMHNXAdAvJW2hXdka5boR4vKMS/F5BTR5sULkbht9xPk/EKzbY2mCczMutZqQ==",
"license": "MIT",
"dependencies": {
- "@babel/parser": "^7.29.14",
- "@babel/types": "^7.29.14",
+ "@babel/parser": "^7.29.15",
+ "@babel/types": "^7.29.15",
"@jridgewell/gen-mapping": "^0.3.12",
"@jridgewell/trace-mapping": "^0.3.28",
"jsesc": "^3.0.2"
@@ -73,9 +73,9 @@
}
},
"node_modules/@babel/helper-string-parser": {
- "version": "7.29.14",
- "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.14.tgz",
- "integrity": "sha512-CXvKMFvM80ihI7Vox9jb+kQjnyjESQNPM+vB7U0Zz6TWuZA+Z/FL0QPMH300h33qJtIx+REeBhXqWOPW48TcAQ==",
+ "version": "7.29.15",
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.15.tgz",
+ "integrity": "sha512-C2FuapQ2Kh1OnVHAoLi5rD3GBJ8COb9Q609T6HEpLqaBAo560PDP5OxBE5dCI/h951MBO/+bCUYU5SZ+8ZlV+w==",
"license": "MIT",
"engines": {
"node": ">=6.9.0"
@@ -91,12 +91,12 @@
}
},
"node_modules/@babel/parser": {
- "version": "7.29.14",
- "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.14.tgz",
- "integrity": "sha512-VL220vXuyO2z3rNIQwY7ftj9UwpqOt+33sH+sBWkOekbsSR2g7EEMnOx24ZlCH0xOA3DM/33SifVFGbnJD8r/w==",
+ "version": "7.29.15",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.15.tgz",
+ "integrity": "sha512-RpKWyisHoP81twtSCgmE02iU0RnPcq1DN5bBEbpUePrjA9Q3wXhufnCJrrayPpoZieqFh3zyZQqwtSK0gGccRA==",
"license": "MIT",
"dependencies": {
- "@babel/types": "^7.29.14"
+ "@babel/types": "^7.29.15"
},
"bin": {
"parser": "bin/babel-parser.js"
@@ -106,9 +106,9 @@
}
},
"node_modules/@babel/runtime": {
- "version": "7.29.14",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.14.tgz",
- "integrity": "sha512-Y5tqevQaUAZhhj82BpYMNC1ssvLQTVAfwKdm8iy8qwmhvC2/CpcAu8OC+QEtjM7pMk7knx83u1Qj8gzkicyelw==",
+ "version": "7.29.16",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.16.tgz",
+ "integrity": "sha512-LKBjGopxrQE0aFucNL69OyyyF143MOWUULEOftU3oCgyD35Sy84UUpVnt/sNvTb7ZmCyALSt7om+fojlW35zYQ==",
"license": "MIT",
"engines": {
"node": ">=6.9.0"
@@ -129,17 +129,17 @@
}
},
"node_modules/@babel/traverse": {
- "version": "7.29.14",
- "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.14.tgz",
- "integrity": "sha512-RAdQJrBgmIH1FWvN0X+1hoDxzMzlP4cv/1Zi4dn4tG1H0cTb+rw7CzUxQJhp1f4ANd8j5vH3fy8BAWFGkBDEsA==",
+ "version": "7.29.16",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.16.tgz",
+ "integrity": "sha512-a16ah9dTLOLUq5BL7NElJ7keefg/276vgfTfExDf1PizddYboqRnQXDTooVPb0VArIqrKe8KLlghnTxlZFEZtQ==",
"license": "MIT",
"dependencies": {
"@babel/code-frame": "^7.29.7",
- "@babel/generator": "^7.29.14",
+ "@babel/generator": "^7.29.16",
"@babel/helper-globals": "^7.29.7",
- "@babel/parser": "^7.29.14",
+ "@babel/parser": "^7.29.15",
"@babel/template": "^7.29.7",
- "@babel/types": "^7.29.14",
+ "@babel/types": "^7.29.15",
"debug": "^4.3.1"
},
"engines": {
@@ -147,12 +147,12 @@
}
},
"node_modules/@babel/types": {
- "version": "7.29.14",
- "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.14.tgz",
- "integrity": "sha512-UjI/dKmwJwT9pOszJitq2G6EObZPnsZUfdCr92z2TlF3EZK9J3EdfOKUrCzHl6wFthbzwhzl1Soc/UIwxRiq6w==",
+ "version": "7.29.15",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.15.tgz",
+ "integrity": "sha512-/XKpKDakL//LZ66bq1XsZOswuqeI5MZqPLDu18o3XdkU1fNJ7bdPtzgnc4ZNS+bBGHV0FJG8jjb8SwcC3nNVQQ==",
"license": "MIT",
"dependencies": {
- "@babel/helper-string-parser": "^7.29.14",
+ "@babel/helper-string-parser": "^7.29.15",
"@babel/helper-validator-identifier": "^7.29.7"
},
"engines": {
@@ -968,12 +968,12 @@
}
},
"node_modules/@thunderid/browser": {
- "version": "1.19.0",
- "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.19.0.tgz",
- "integrity": "sha512-9FgwTaBwIFozB73xXeh5LvwHri3blW+zozAYYlMpNPWagzMfOxx7XRd6Qm7ajPm6lXJA1vIbYixiC4a8o+A5EQ==",
+ "version": "1.27.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.27.0.tgz",
+ "integrity": "sha512-WLtyzL+vx8Z4faaw+CtVHTwaBUZj4MkZzmPpUVZLOQSYuV1b7zRiTTpUUhqkSG/TCMMg78gjDDQDGh2yTF4yqg==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.20.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"buffer": "6.0.3",
"core-js": "3.42.0",
@@ -986,9 +986,9 @@
}
},
"node_modules/@thunderid/javascript": {
- "version": "1.21.0",
- "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.21.0.tgz",
- "integrity": "sha512-p2tVpFv8S46BCX4smJ6z+aKuFxTB9IIAqbIbpj+5yDkpO5h7ePWZubXEyeB3MKQvhqhjNKxcMFTUjBE6N41FaQ==",
+ "version": "1.28.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.28.0.tgz",
+ "integrity": "sha512-IIJimiNPJCzFeDIw72tYwr2KkEE0vygvHt03DSTfsOoNp/nR0RjMyoP+BFh1+VRLGtb5DucdCJt1UnbnD/0bOw==",
"license": "Apache-2.0",
"dependencies": {
"jose": "6.2.3",
@@ -996,13 +996,13 @@
}
},
"node_modules/@thunderid/nextjs": {
- "version": "1.20.0",
- "resolved": "https://registry.npmjs.org/@thunderid/nextjs/-/nextjs-1.20.0.tgz",
- "integrity": "sha512-pAHhhDD+4TBdWfTyFll5U/FeeRt4DSIqKACbRODzczYpq5Byl14XSy4bBl1hmTe2gvpCclFSb+Yzs+JyqStvOw==",
+ "version": "1.25.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/nextjs/-/nextjs-1.25.0.tgz",
+ "integrity": "sha512-QS1Y17cxh2FGiIXERn1Jxg2geApzw61mbBIUcew8ZMaNOZNfEeGcPACCAm5cJ2HRlfGPPszOqfDttnE1kEp5Jg==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/node": "^1.18.0",
- "@thunderid/react": "^1.22.1",
+ "@thunderid/node": "^1.23.0",
+ "@thunderid/react": "^1.29.0",
"@types/react": "19.2.14",
"jose": "6.2.3",
"tslib": "2.8.1"
@@ -1013,14 +1013,14 @@
}
},
"node_modules/@thunderid/nextjs/node_modules/@thunderid/react": {
- "version": "1.22.1",
- "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.22.1.tgz",
- "integrity": "sha512-Kd75Mn0IedrTDEIb8mi9dEo+fh7WhbI0jcX7Mvf0LFaksMHxNVcoWHE6k9GJEB4kRfdtKOAEN9FH9emn1igWNw==",
+ "version": "1.29.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.29.0.tgz",
+ "integrity": "sha512-a4XX5xo+iruU2zrcQVwZuIOZ2tlzLMGRuVR+FykL04z5MEAwIvEq6UJxD2EImRwJGxDQ0W+ew5caypzyXIqJLA==",
"license": "Apache-2.0",
"dependencies": {
"@emotion/css": "11.13.5",
"@floating-ui/react": "0.27.12",
- "@thunderid/browser": "^1.19.0",
+ "@thunderid/browser": "^1.27.0",
"dompurify": "3.4.17",
"tslib": "2.8.1"
},
@@ -1059,12 +1059,12 @@
}
},
"node_modules/@thunderid/node": {
- "version": "1.18.0",
- "resolved": "https://registry.npmjs.org/@thunderid/node/-/node-1.18.0.tgz",
- "integrity": "sha512-6Njj8P5onKE3puipqcK8CD/t7hs0Uf5x2Fm+V+f+z8zJ/wxMzzacY4XU0jKl1rAKx2hLWbCnnV34a9pfEavcYg==",
+ "version": "1.23.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/node/-/node-1.23.0.tgz",
+ "integrity": "sha512-e+0ei7wsHjclKYjy0b70xtbALPUNVoA9UoXId3qpSPSoJ6SftBRLX257Dlkf/u6WjkemSYZ2EVOqFkqOMJ/+/Q==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.21.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"cross-fetch": "4.1.0",
"fast-sha256": "1.3.0",
@@ -1924,9 +1924,9 @@
}
},
"node_modules/string_decoder": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
- "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.4.0.tgz",
+ "integrity": "sha512-r8azg21Y67ckRmeG0hHol5CeDXMs4ZFkFT6eXMO39hX7khvJcopBcYTCeWZ0rQXkMoPh8lVdbjmsOMGL8krxRQ==",
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.2.0"
@@ -1974,9 +1974,9 @@
}
},
"node_modules/tabbable": {
- "version": "6.5.1",
- "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.5.1.tgz",
- "integrity": "sha512-dMCuwDUY6Noz3zVKLefBC4wq+aJV20yc7vWmM7uTNGwtQSFF5kX7OUIUsxuVajz/bdt5Xqdah3/0NLjth+cM5A==",
+ "version": "6.5.2",
+ "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.5.2.tgz",
+ "integrity": "sha512-XgdnB1nGU6KU4VgMnZPaZCx7M1hBrLyEiZYau2G2gq9UT0d7d4FUBlNX7vvPlm/B1vk1PjrzJBx9Lbv4fsqS9g==",
"license": "MIT"
},
"node_modules/tr46": {
diff --git a/quickstarts/quickstart-nextjs-b2b/package.json b/quickstarts/quickstart-nextjs-b2b/package.json
index 8c26f61..bf95525 100644
--- a/quickstarts/quickstart-nextjs-b2b/package.json
+++ b/quickstarts/quickstart-nextjs-b2b/package.json
@@ -8,7 +8,7 @@
"start": "next start"
},
"dependencies": {
- "@thunderid/nextjs": "1.20.0",
+ "@thunderid/nextjs": "latest",
"next": "16.4.5",
"react": "19.2.3",
"react-dom": "19.2.3"
diff --git a/quickstarts/quickstart-nextjs/.env.example b/quickstarts/quickstart-nextjs/.env.example
index 66cdadd..dfa0876 100644
--- a/quickstarts/quickstart-nextjs/.env.example
+++ b/quickstarts/quickstart-nextjs/.env.example
@@ -6,8 +6,9 @@ NEXT_PUBLIC_THUNDERID_BASE_URL=https://localhost:8090
# from the app's Credentials tab (under Edit). Server-only, never expose to the browser.
THUNDERID_FLOW_SECRET=your-flow-secret-here
-# Secret used to encrypt this app's session cookie. Generate locally, not from the console.
-THUNDERID_SECRET=generate-with-openssl-rand-base64-32
+# Encrypts this app's session cookie. At least 32 bytes; generate it locally with
+# `openssl rand -base64 32`, not from the console.
+THUNDERID_SESSION_SECRET=generate-with-openssl-rand-base64-32
# Application ID (spId) for this app. ThunderID Console -> your application -> Overview.
NEXT_PUBLIC_THUNDERID_APPLICATION_ID=your-application-id-here
diff --git a/quickstarts/quickstart-nextjs/README.md b/quickstarts/quickstart-nextjs/README.md
index 1323a18..24a3181 100644
--- a/quickstarts/quickstart-nextjs/README.md
+++ b/quickstarts/quickstart-nextjs/README.md
@@ -33,7 +33,7 @@ cd my-app
| `NEXT_PUBLIC_THUNDERID_BASE_URL` | Base URL of your ThunderID server. |
| `NEXT_PUBLIC_THUNDERID_APPLICATION_ID` | Application ID of the application. |
| `THUNDERID_FLOW_SECRET` | Flow Secret of the application. Server-only. |
- | `THUNDERID_SECRET` | Encrypts the session cookie. Generate it with `openssl rand -base64 32`. |
+ | `THUNDERID_SESSION_SECRET` | Encrypts the session cookie. At least 32 bytes, which production requires. Generate it with `openssl rand -base64 32`. |
| `NEXT_PUBLIC_THUNDERID_SIGN_IN_URL` | The app's sign-in route. Keep `/signin`. |
| `NEXT_PUBLIC_THUNDERID_SIGN_UP_URL` | The app's sign-up route. Keep `/signup`. |
| `NODE_TLS_REJECT_UNAUTHORIZED` | Set to `0` in the example to accept a local server's self-signed certificate. Local development only. |
diff --git a/quickstarts/quickstart-nextjs/app/layout.tsx b/quickstarts/quickstart-nextjs/app/layout.tsx
index d67dade..df53fbe 100644
--- a/quickstarts/quickstart-nextjs/app/layout.tsx
+++ b/quickstarts/quickstart-nextjs/app/layout.tsx
@@ -18,7 +18,7 @@ const isRedirectFlow = Boolean(process.env.NEXT_PUBLIC_THUNDERID_CLIENT_ID)
const REQUIRED_ENV_VARS = [
'NEXT_PUBLIC_THUNDERID_BASE_URL',
- 'THUNDERID_SECRET',
+ 'THUNDERID_SESSION_SECRET',
...(isRedirectFlow
? ['NEXT_PUBLIC_THUNDERID_CLIENT_ID', 'THUNDERID_CLIENT_SECRET']
: ['NEXT_PUBLIC_THUNDERID_APPLICATION_ID', 'NEXT_PUBLIC_THUNDERID_SIGN_IN_URL', 'NEXT_PUBLIC_THUNDERID_SIGN_UP_URL', 'THUNDERID_FLOW_SECRET']),
diff --git a/quickstarts/quickstart-nextjs/package-lock.json b/quickstarts/quickstart-nextjs/package-lock.json
index 52ae04c..a713860 100644
--- a/quickstarts/quickstart-nextjs/package-lock.json
+++ b/quickstarts/quickstart-nextjs/package-lock.json
@@ -8,7 +8,7 @@
"name": "@thunderid/quickstart-nextjs-sample",
"version": "1.0.1",
"dependencies": {
- "@thunderid/nextjs": "1.3.0",
+ "@thunderid/nextjs": "latest",
"next": "^15.5.29",
"react": "^19.2.9",
"react-dom": "^19.2.9"
@@ -35,13 +35,13 @@
}
},
"node_modules/@babel/generator": {
- "version": "7.29.8",
- "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.8.tgz",
- "integrity": "sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==",
+ "version": "7.29.16",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.16.tgz",
+ "integrity": "sha512-yRtddtrcYdLJt0l70aP7usb2YpMHNXAdAvJW2hXdka5boR4vKMS/F5BTR5sULkbht9xPk/EKzbY2mCczMutZqQ==",
"license": "MIT",
"dependencies": {
- "@babel/parser": "^7.29.8",
- "@babel/types": "^7.29.8",
+ "@babel/parser": "^7.29.15",
+ "@babel/types": "^7.29.15",
"@jridgewell/gen-mapping": "^0.3.12",
"@jridgewell/trace-mapping": "^0.3.28",
"jsesc": "^3.0.2"
@@ -73,9 +73,9 @@
}
},
"node_modules/@babel/helper-string-parser": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz",
- "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==",
+ "version": "7.29.15",
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.15.tgz",
+ "integrity": "sha512-C2FuapQ2Kh1OnVHAoLi5rD3GBJ8COb9Q609T6HEpLqaBAo560PDP5OxBE5dCI/h951MBO/+bCUYU5SZ+8ZlV+w==",
"license": "MIT",
"engines": {
"node": ">=6.9.0"
@@ -91,12 +91,12 @@
}
},
"node_modules/@babel/parser": {
- "version": "7.29.9",
- "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.9.tgz",
- "integrity": "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==",
+ "version": "7.29.15",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.15.tgz",
+ "integrity": "sha512-RpKWyisHoP81twtSCgmE02iU0RnPcq1DN5bBEbpUePrjA9Q3wXhufnCJrrayPpoZieqFh3zyZQqwtSK0gGccRA==",
"license": "MIT",
"dependencies": {
- "@babel/types": "^7.29.8"
+ "@babel/types": "^7.29.15"
},
"bin": {
"parser": "bin/babel-parser.js"
@@ -106,9 +106,9 @@
}
},
"node_modules/@babel/runtime": {
- "version": "7.29.10",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.10.tgz",
- "integrity": "sha512-NpugTzbKgGrNe45Ui32cN8vCFFMxVtP/9rtfwv0nP5FRDAjvYBxJcLVpYA9mr1jxP6cnIT7x9LUzuDTbWYYNRA==",
+ "version": "7.29.16",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.16.tgz",
+ "integrity": "sha512-LKBjGopxrQE0aFucNL69OyyyF143MOWUULEOftU3oCgyD35Sy84UUpVnt/sNvTb7ZmCyALSt7om+fojlW35zYQ==",
"license": "MIT",
"engines": {
"node": ">=6.9.0"
@@ -129,17 +129,17 @@
}
},
"node_modules/@babel/traverse": {
- "version": "7.29.10",
- "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.10.tgz",
- "integrity": "sha512-B3lYAs2nkKskbgQ1nfy8Ma9ao9Q1rntTAQHrzzyDuj+TSO+X3le6PfWwqDvodsb+OumE10eMFfuMCTQSQ5iuIQ==",
+ "version": "7.29.16",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.16.tgz",
+ "integrity": "sha512-a16ah9dTLOLUq5BL7NElJ7keefg/276vgfTfExDf1PizddYboqRnQXDTooVPb0VArIqrKe8KLlghnTxlZFEZtQ==",
"license": "MIT",
"dependencies": {
"@babel/code-frame": "^7.29.7",
- "@babel/generator": "^7.29.8",
+ "@babel/generator": "^7.29.16",
"@babel/helper-globals": "^7.29.7",
- "@babel/parser": "^7.29.9",
+ "@babel/parser": "^7.29.15",
"@babel/template": "^7.29.7",
- "@babel/types": "^7.29.8",
+ "@babel/types": "^7.29.15",
"debug": "^4.3.1"
},
"engines": {
@@ -147,12 +147,12 @@
}
},
"node_modules/@babel/types": {
- "version": "7.29.8",
- "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz",
- "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==",
+ "version": "7.29.15",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.15.tgz",
+ "integrity": "sha512-/XKpKDakL//LZ66bq1XsZOswuqeI5MZqPLDu18o3XdkU1fNJ7bdPtzgnc4ZNS+bBGHV0FJG8jjb8SwcC3nNVQQ==",
"license": "MIT",
"dependencies": {
- "@babel/helper-string-parser": "^7.29.7",
+ "@babel/helper-string-parser": "^7.29.15",
"@babel/helper-validator-identifier": "^7.29.7"
},
"engines": {
@@ -876,9 +876,9 @@
}
},
"node_modules/@jridgewell/resolve-uri": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
- "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.3.tgz",
+ "integrity": "sha512-lhTtjtoEArWBjismtfS761S9Hlyn+nIZqOZVYoZ1Xn82PMNMVnk+jj/NhC4fAXGTs7ydONcJiR5vyQBTMDu27g==",
"license": "MIT",
"engines": {
"node": ">=6.0.0"
@@ -1056,12 +1056,12 @@
}
},
"node_modules/@thunderid/browser": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.3.0.tgz",
- "integrity": "sha512-O6DHlUyVFfBaNcJDEXACLU4NJMrNjDlqAuzesvJ+8a0Gl5g8WFK53rpx027e/rWICG0vcGe2UVZuhvZq5Z511A==",
+ "version": "1.27.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.27.0.tgz",
+ "integrity": "sha512-WLtyzL+vx8Z4faaw+CtVHTwaBUZj4MkZzmPpUVZLOQSYuV1b7zRiTTpUUhqkSG/TCMMg78gjDDQDGh2yTF4yqg==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.4.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"buffer": "6.0.3",
"core-js": "3.42.0",
@@ -1074,9 +1074,9 @@
}
},
"node_modules/@thunderid/javascript": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.4.0.tgz",
- "integrity": "sha512-qHfIFzXOQTN1nhuBT91Tr8bLPvfyEDa7gUQSL7GNcJkcyyKfJ77meIwr91lCme0ySFUnTeKl0Bk+R8iIJiKXBw==",
+ "version": "1.28.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.28.0.tgz",
+ "integrity": "sha512-IIJimiNPJCzFeDIw72tYwr2KkEE0vygvHt03DSTfsOoNp/nR0RjMyoP+BFh1+VRLGtb5DucdCJt1UnbnD/0bOw==",
"license": "Apache-2.0",
"dependencies": {
"jose": "6.2.3",
@@ -1084,13 +1084,13 @@
}
},
"node_modules/@thunderid/nextjs": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@thunderid/nextjs/-/nextjs-1.3.0.tgz",
- "integrity": "sha512-MssmgDizw2OYy7p4+XJku3cHhz6TrTgjeyOGvc0TWD1f/en5/jggxy7g9RmDAuKPKRQ4C9eCAvtpHuvN73rMvg==",
+ "version": "1.25.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/nextjs/-/nextjs-1.25.0.tgz",
+ "integrity": "sha512-QS1Y17cxh2FGiIXERn1Jxg2geApzw61mbBIUcew8ZMaNOZNfEeGcPACCAm5cJ2HRlfGPPszOqfDttnE1kEp5Jg==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/node": "^1.3.0",
- "@thunderid/react": "^1.4.0",
+ "@thunderid/node": "^1.23.0",
+ "@thunderid/react": "^1.29.0",
"@types/react": "19.2.14",
"jose": "6.2.3",
"tslib": "2.8.1"
@@ -1110,12 +1110,12 @@
}
},
"node_modules/@thunderid/node": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@thunderid/node/-/node-1.3.0.tgz",
- "integrity": "sha512-hAFf4Bv3JZTcatF7Y/iarbd3lYLbIkz6SHzGKG5HOwh/a/Ip8qpu7u4npF6/0cNzrvZzY5g6awIymsIav75Xqw==",
+ "version": "1.23.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/node/-/node-1.23.0.tgz",
+ "integrity": "sha512-e+0ei7wsHjclKYjy0b70xtbALPUNVoA9UoXId3qpSPSoJ6SftBRLX257Dlkf/u6WjkemSYZ2EVOqFkqOMJ/+/Q==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.4.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"cross-fetch": "4.1.0",
"fast-sha256": "1.3.0",
@@ -1127,15 +1127,15 @@
}
},
"node_modules/@thunderid/react": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.4.0.tgz",
- "integrity": "sha512-MRSnxgAYCnQKXLaAcWd4oiX7H0RfMVtQr8eeDD8aA+TbJYYt2uSIuSEAgOad7iMbVL+xw174n/S/lw6ekKLBqg==",
+ "version": "1.29.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.29.0.tgz",
+ "integrity": "sha512-a4XX5xo+iruU2zrcQVwZuIOZ2tlzLMGRuVR+FykL04z5MEAwIvEq6UJxD2EImRwJGxDQ0W+ew5caypzyXIqJLA==",
"license": "Apache-2.0",
"dependencies": {
"@emotion/css": "11.13.5",
"@floating-ui/react": "0.27.12",
- "@thunderid/browser": "^1.3.0",
- "dompurify": "3.4.13",
+ "@thunderid/browser": "^1.27.0",
+ "dompurify": "3.4.17",
"tslib": "2.8.1"
},
"peerDependencies": {
@@ -1512,9 +1512,9 @@
"license": "MIT"
},
"node_modules/is-core-module": {
- "version": "2.17.0",
- "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.17.0.tgz",
- "integrity": "sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA==",
+ "version": "2.18.0",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.18.0.tgz",
+ "integrity": "sha512-qyax9fgaKOEC4qK8WZn7Q4IcoZC9RC1O1fFxRcRTq/oMMkWT/uXpqpXa12kzWR409zAt1drYN9N9BO26UmBCmw==",
"license": "MIT",
"dependencies": {
"hasown": "^2.0.4"
@@ -1809,13 +1809,13 @@
}
},
"node_modules/resolve": {
- "version": "1.22.13",
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.13.tgz",
- "integrity": "sha512-Dj/cW9zBV2aRj6XzCxuGIs3ESZKv02jixne3q6jFZYZ3/Tg09gHHviSMDL4kObh9pqSahdRHEnDoaP2gn8YLhA==",
+ "version": "1.22.14",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.14.tgz",
+ "integrity": "sha512-1ZjYvR9sbkiwC5+9QHetqW5HmA2pHRMaoupD01t2HlYnV/vydC2zPwLixhsMieSWVZt0JJRg5LVIk0Ow1D/TrA==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
- "is-core-module": "^2.17.0",
+ "is-core-module": "^2.18.0",
"path-parse": "^1.0.7",
"supports-preserve-symlinks-flag": "^1.0.0"
},
@@ -1980,9 +1980,9 @@
}
},
"node_modules/string_decoder": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
- "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.4.0.tgz",
+ "integrity": "sha512-r8azg21Y67ckRmeG0hHol5CeDXMs4ZFkFT6eXMO39hX7khvJcopBcYTCeWZ0rQXkMoPh8lVdbjmsOMGL8krxRQ==",
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.2.0"
@@ -2030,9 +2030,9 @@
}
},
"node_modules/tabbable": {
- "version": "6.5.0",
- "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.5.0.tgz",
- "integrity": "sha512-wieBHXygIm7OyQOu5hQlkk62/WyCFYGlWg7L6/ZCUZwx0o398Zkn4pVmMyfYhfMG8kGrj/Krt8eIk6UKC6VzwA==",
+ "version": "6.5.2",
+ "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.5.2.tgz",
+ "integrity": "sha512-XgdnB1nGU6KU4VgMnZPaZCx7M1hBrLyEiZYau2G2gq9UT0d7d4FUBlNX7vvPlm/B1vk1PjrzJBx9Lbv4fsqS9g==",
"license": "MIT"
},
"node_modules/tr46": {
diff --git a/quickstarts/quickstart-nextjs/package.json b/quickstarts/quickstart-nextjs/package.json
index f14bb43..74587c4 100644
--- a/quickstarts/quickstart-nextjs/package.json
+++ b/quickstarts/quickstart-nextjs/package.json
@@ -10,7 +10,7 @@
"start": "next start"
},
"dependencies": {
- "@thunderid/nextjs": "1.3.0",
+ "@thunderid/nextjs": "latest",
"next": "^15.5.29",
"react": "^19.2.9",
"react-dom": "^19.2.9"
diff --git a/quickstarts/quickstart-node/package-lock.json b/quickstarts/quickstart-node/package-lock.json
index 7c7d4f2..0aa9192 100644
--- a/quickstarts/quickstart-node/package-lock.json
+++ b/quickstarts/quickstart-node/package-lock.json
@@ -8,15 +8,15 @@
"name": "@thunderid/quickstart-node-sample",
"version": "1.0.1",
"dependencies": {
- "@thunderid/node": "1.3.0",
+ "@thunderid/node": "latest",
"boxen": "^8.0.1",
"picocolors": "^1.1.1"
}
},
"node_modules/@thunderid/javascript": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.4.0.tgz",
- "integrity": "sha512-qHfIFzXOQTN1nhuBT91Tr8bLPvfyEDa7gUQSL7GNcJkcyyKfJ77meIwr91lCme0ySFUnTeKl0Bk+R8iIJiKXBw==",
+ "version": "1.28.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.28.0.tgz",
+ "integrity": "sha512-IIJimiNPJCzFeDIw72tYwr2KkEE0vygvHt03DSTfsOoNp/nR0RjMyoP+BFh1+VRLGtb5DucdCJt1UnbnD/0bOw==",
"license": "Apache-2.0",
"dependencies": {
"jose": "6.2.3",
@@ -24,12 +24,12 @@
}
},
"node_modules/@thunderid/node": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@thunderid/node/-/node-1.3.0.tgz",
- "integrity": "sha512-hAFf4Bv3JZTcatF7Y/iarbd3lYLbIkz6SHzGKG5HOwh/a/Ip8qpu7u4npF6/0cNzrvZzY5g6awIymsIav75Xqw==",
+ "version": "1.23.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/node/-/node-1.23.0.tgz",
+ "integrity": "sha512-e+0ei7wsHjclKYjy0b70xtbALPUNVoA9UoXId3qpSPSoJ6SftBRLX257Dlkf/u6WjkemSYZ2EVOqFkqOMJ/+/Q==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.4.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"cross-fetch": "4.1.0",
"fast-sha256": "1.3.0",
diff --git a/quickstarts/quickstart-node/package.json b/quickstarts/quickstart-node/package.json
index 5389cff..ba6c122 100644
--- a/quickstarts/quickstart-node/package.json
+++ b/quickstarts/quickstart-node/package.json
@@ -9,7 +9,7 @@
"dev": "node --env-file-if-exists=.env --watch index.mjs"
},
"dependencies": {
- "@thunderid/node": "1.3.0",
+ "@thunderid/node": "latest",
"boxen": "^8.0.1",
"picocolors": "^1.1.1"
}
diff --git a/quickstarts/quickstart-nuxt/.env.example b/quickstarts/quickstart-nuxt/.env.example
index fbeed8e..958087a 100644
--- a/quickstarts/quickstart-nuxt/.env.example
+++ b/quickstarts/quickstart-nuxt/.env.example
@@ -6,7 +6,8 @@ NUXT_PUBLIC_THUNDERID_BASE_URL=https://localhost:8090
# from the app's Credentials tab (under Edit). Server-only, never expose to the browser.
THUNDERID_FLOW_SECRET=your-flow-secret-here
-# Secret used to encrypt this app's session cookie. Generate locally, not from the console.
+# Encrypts this app's session cookie. At least 32 bytes, which production requires; generate it
+# locally with `openssl rand -base64 32`, not from the console.
THUNDERID_SESSION_SECRET=generate-with-openssl-rand-base64-32
# Application ID (spId) for this app. ThunderID Console -> your application -> Overview.
diff --git a/quickstarts/quickstart-nuxt/README.md b/quickstarts/quickstart-nuxt/README.md
index 2b49a95..a99303e 100644
--- a/quickstarts/quickstart-nuxt/README.md
+++ b/quickstarts/quickstart-nuxt/README.md
@@ -33,7 +33,7 @@ cd my-app
| `NUXT_PUBLIC_THUNDERID_BASE_URL` | Base URL of your ThunderID server. |
| `NUXT_PUBLIC_THUNDERID_APPLICATION_ID` | Application ID of the application. |
| `THUNDERID_FLOW_SECRET` | Flow Secret of the application. Server-only. |
- | `THUNDERID_SESSION_SECRET` | Encrypts the session cookie. Generate it with `openssl rand -base64 32`. |
+ | `THUNDERID_SESSION_SECRET` | Encrypts the session cookie. At least 32 bytes, which production requires. Generate it with `openssl rand -base64 32`. |
| `NUXT_PUBLIC_THUNDERID_SIGN_IN_URL` | The app's sign-in route. Keep `/signin`. |
| `NUXT_PUBLIC_THUNDERID_SIGN_UP_URL` | The app's sign-up route. Keep `/signup`. |
| `NODE_TLS_REJECT_UNAUTHORIZED` | Set to `0` in the example to accept a local server's self-signed certificate. Local development only. |
diff --git a/quickstarts/quickstart-nuxt/package-lock.json b/quickstarts/quickstart-nuxt/package-lock.json
index 51e8847..84b1854 100644
--- a/quickstarts/quickstart-nuxt/package-lock.json
+++ b/quickstarts/quickstart-nuxt/package-lock.json
@@ -8,7 +8,7 @@
"name": "@thunderid/quickstart-nuxt-sample",
"version": "1.0.1",
"dependencies": {
- "@thunderid/nuxt": "1.3.0",
+ "@thunderid/nuxt": "latest",
"nuxt": "^4.6.4",
"vue": "^3.5.13"
}
@@ -3013,12 +3013,12 @@
"license": "CC0-1.0"
},
"node_modules/@thunderid/browser": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.3.0.tgz",
- "integrity": "sha512-O6DHlUyVFfBaNcJDEXACLU4NJMrNjDlqAuzesvJ+8a0Gl5g8WFK53rpx027e/rWICG0vcGe2UVZuhvZq5Z511A==",
+ "version": "1.27.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.27.0.tgz",
+ "integrity": "sha512-WLtyzL+vx8Z4faaw+CtVHTwaBUZj4MkZzmPpUVZLOQSYuV1b7zRiTTpUUhqkSG/TCMMg78gjDDQDGh2yTF4yqg==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.4.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"buffer": "6.0.3",
"core-js": "3.42.0",
@@ -3031,9 +3031,9 @@
}
},
"node_modules/@thunderid/javascript": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.4.0.tgz",
- "integrity": "sha512-qHfIFzXOQTN1nhuBT91Tr8bLPvfyEDa7gUQSL7GNcJkcyyKfJ77meIwr91lCme0ySFUnTeKl0Bk+R8iIJiKXBw==",
+ "version": "1.28.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.28.0.tgz",
+ "integrity": "sha512-IIJimiNPJCzFeDIw72tYwr2KkEE0vygvHt03DSTfsOoNp/nR0RjMyoP+BFh1+VRLGtb5DucdCJt1UnbnD/0bOw==",
"license": "Apache-2.0",
"dependencies": {
"jose": "6.2.3",
@@ -3041,12 +3041,12 @@
}
},
"node_modules/@thunderid/node": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@thunderid/node/-/node-1.3.0.tgz",
- "integrity": "sha512-hAFf4Bv3JZTcatF7Y/iarbd3lYLbIkz6SHzGKG5HOwh/a/Ip8qpu7u4npF6/0cNzrvZzY5g6awIymsIav75Xqw==",
+ "version": "1.23.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/node/-/node-1.23.0.tgz",
+ "integrity": "sha512-e+0ei7wsHjclKYjy0b70xtbALPUNVoA9UoXId3qpSPSoJ6SftBRLX257Dlkf/u6WjkemSYZ2EVOqFkqOMJ/+/Q==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.4.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"cross-fetch": "4.1.0",
"fast-sha256": "1.3.0",
@@ -3058,15 +3058,15 @@
}
},
"node_modules/@thunderid/nuxt": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@thunderid/nuxt/-/nuxt-1.3.0.tgz",
- "integrity": "sha512-Vx+gkFQd0xShBED6sRLOr8hCz2oqmoD+q9P5+clGM5ptVFHxJL7Qveo+7VGgvSwpjfsUsn5kGwDoLfBGX5QbBA==",
+ "version": "1.25.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/nuxt/-/nuxt-1.25.0.tgz",
+ "integrity": "sha512-gkSIhAHfU9PEXquZPbLKt3SCPlyoK3EnsDKzoo8T7W8lIRN0tAOOE4UpI93kiGtWlWApe7p5S/95spE6qP+5bw==",
"license": "Apache-2.0",
"dependencies": {
"@nuxt/kit": "3.21.11",
- "@thunderid/browser": "^1.3.0",
- "@thunderid/node": "^1.3.0",
- "@thunderid/vue": "^1.4.0",
+ "@thunderid/browser": "^1.27.0",
+ "@thunderid/node": "^1.23.0",
+ "@thunderid/vue": "^1.26.0",
"defu": "6.1.5",
"jose": "6.2.3"
},
@@ -3076,13 +3076,13 @@
}
},
"node_modules/@thunderid/vue": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/@thunderid/vue/-/vue-1.4.0.tgz",
- "integrity": "sha512-a/38OLJOb7vfyTgRsrbxh1SaDpoWRok9dg0nHO0KPjy5uKSHIEFKaPgbthd879zuuC0Pfm1jcovr3E5gmjtZ0w==",
+ "version": "1.26.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/vue/-/vue-1.26.0.tgz",
+ "integrity": "sha512-tGAmDlh16LyGkxowqxDYmD/VwRzqrCiUrbdRsqlmvh6/gNaJanK4HnTOA4kiRDuFQ0h/G8VAnMQ2EXNvmm952w==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/browser": "^1.3.0",
- "dompurify": "3.4.13",
+ "@thunderid/browser": "^1.27.0",
+ "dompurify": "3.4.17",
"tslib": "2.8.1"
},
"peerDependencies": {
diff --git a/quickstarts/quickstart-nuxt/package.json b/quickstarts/quickstart-nuxt/package.json
index 7f5936d..0f54a59 100644
--- a/quickstarts/quickstart-nuxt/package.json
+++ b/quickstarts/quickstart-nuxt/package.json
@@ -11,7 +11,7 @@
"preview": "nuxt preview"
},
"dependencies": {
- "@thunderid/nuxt": "1.3.0",
+ "@thunderid/nuxt": "latest",
"nuxt": "^4.6.4",
"vue": "^3.5.13"
},
diff --git a/quickstarts/quickstart-react-b2b/package-lock.json b/quickstarts/quickstart-react-b2b/package-lock.json
index a7364e4..dea8018 100644
--- a/quickstarts/quickstart-react-b2b/package-lock.json
+++ b/quickstarts/quickstart-react-b2b/package-lock.json
@@ -8,7 +8,7 @@
"name": "@thunderid/quickstart-react-b2b-sample",
"version": "0.0.1",
"dependencies": {
- "@thunderid/react": "1.22.1",
+ "@thunderid/react": "latest",
"react": "19.2.3",
"react-dom": "19.2.3"
},
@@ -686,12 +686,12 @@
"license": "MIT"
},
"node_modules/@thunderid/browser": {
- "version": "1.19.0",
- "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.19.0.tgz",
- "integrity": "sha512-9FgwTaBwIFozB73xXeh5LvwHri3blW+zozAYYlMpNPWagzMfOxx7XRd6Qm7ajPm6lXJA1vIbYixiC4a8o+A5EQ==",
+ "version": "1.27.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.27.0.tgz",
+ "integrity": "sha512-WLtyzL+vx8Z4faaw+CtVHTwaBUZj4MkZzmPpUVZLOQSYuV1b7zRiTTpUUhqkSG/TCMMg78gjDDQDGh2yTF4yqg==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.20.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"buffer": "6.0.3",
"core-js": "3.42.0",
@@ -704,9 +704,9 @@
}
},
"node_modules/@thunderid/javascript": {
- "version": "1.20.0",
- "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.20.0.tgz",
- "integrity": "sha512-Uu56subIW+GJgkF4nVuJyUNRwEPsg0fE9WUkc1GkJSSPt6WnmSMNmDYU+0XWFs/TYbEm4ACUJdGoyxDOnVpb/w==",
+ "version": "1.28.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.28.0.tgz",
+ "integrity": "sha512-IIJimiNPJCzFeDIw72tYwr2KkEE0vygvHt03DSTfsOoNp/nR0RjMyoP+BFh1+VRLGtb5DucdCJt1UnbnD/0bOw==",
"license": "Apache-2.0",
"dependencies": {
"jose": "6.2.3",
@@ -714,14 +714,14 @@
}
},
"node_modules/@thunderid/react": {
- "version": "1.22.1",
- "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.22.1.tgz",
- "integrity": "sha512-Kd75Mn0IedrTDEIb8mi9dEo+fh7WhbI0jcX7Mvf0LFaksMHxNVcoWHE6k9GJEB4kRfdtKOAEN9FH9emn1igWNw==",
+ "version": "1.29.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.29.0.tgz",
+ "integrity": "sha512-a4XX5xo+iruU2zrcQVwZuIOZ2tlzLMGRuVR+FykL04z5MEAwIvEq6UJxD2EImRwJGxDQ0W+ew5caypzyXIqJLA==",
"license": "Apache-2.0",
"dependencies": {
"@emotion/css": "11.13.5",
"@floating-ui/react": "0.27.12",
- "@thunderid/browser": "^1.19.0",
+ "@thunderid/browser": "^1.27.0",
"dompurify": "3.4.17",
"tslib": "2.8.1"
},
@@ -1703,9 +1703,9 @@
}
},
"node_modules/string_decoder": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
- "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.4.0.tgz",
+ "integrity": "sha512-r8azg21Y67ckRmeG0hHol5CeDXMs4ZFkFT6eXMO39hX7khvJcopBcYTCeWZ0rQXkMoPh8lVdbjmsOMGL8krxRQ==",
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.2.0"
diff --git a/quickstarts/quickstart-react-b2b/package.json b/quickstarts/quickstart-react-b2b/package.json
index 2e9c91b..69c2764 100644
--- a/quickstarts/quickstart-react-b2b/package.json
+++ b/quickstarts/quickstart-react-b2b/package.json
@@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
- "@thunderid/react": "1.22.1",
+ "@thunderid/react": "latest",
"react": "19.2.3",
"react-dom": "19.2.3"
},
diff --git a/quickstarts/quickstart-react/package-lock.json b/quickstarts/quickstart-react/package-lock.json
index f6bc175..b50f644 100644
--- a/quickstarts/quickstart-react/package-lock.json
+++ b/quickstarts/quickstart-react/package-lock.json
@@ -8,8 +8,8 @@
"name": "@thunderid/quickstart-react-sample",
"version": "1.0.1",
"dependencies": {
- "@thunderid/react": "1.4.0",
- "@thunderid/react-router": "1.3.0",
+ "@thunderid/react": "latest",
+ "@thunderid/react-router": "latest",
"react": "^19.2.9",
"react-dom": "^19.2.9",
"react-router": "^7.18.2"
@@ -1359,12 +1359,12 @@
]
},
"node_modules/@thunderid/browser": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.3.0.tgz",
- "integrity": "sha512-O6DHlUyVFfBaNcJDEXACLU4NJMrNjDlqAuzesvJ+8a0Gl5g8WFK53rpx027e/rWICG0vcGe2UVZuhvZq5Z511A==",
+ "version": "1.27.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.27.0.tgz",
+ "integrity": "sha512-WLtyzL+vx8Z4faaw+CtVHTwaBUZj4MkZzmPpUVZLOQSYuV1b7zRiTTpUUhqkSG/TCMMg78gjDDQDGh2yTF4yqg==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.4.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"buffer": "6.0.3",
"core-js": "3.42.0",
@@ -1377,9 +1377,9 @@
}
},
"node_modules/@thunderid/javascript": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.4.0.tgz",
- "integrity": "sha512-qHfIFzXOQTN1nhuBT91Tr8bLPvfyEDa7gUQSL7GNcJkcyyKfJ77meIwr91lCme0ySFUnTeKl0Bk+R8iIJiKXBw==",
+ "version": "1.28.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.28.0.tgz",
+ "integrity": "sha512-IIJimiNPJCzFeDIw72tYwr2KkEE0vygvHt03DSTfsOoNp/nR0RjMyoP+BFh1+VRLGtb5DucdCJt1UnbnD/0bOw==",
"license": "Apache-2.0",
"dependencies": {
"jose": "6.2.3",
@@ -1387,15 +1387,15 @@
}
},
"node_modules/@thunderid/react": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.4.0.tgz",
- "integrity": "sha512-MRSnxgAYCnQKXLaAcWd4oiX7H0RfMVtQr8eeDD8aA+TbJYYt2uSIuSEAgOad7iMbVL+xw174n/S/lw6ekKLBqg==",
+ "version": "1.29.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.29.0.tgz",
+ "integrity": "sha512-a4XX5xo+iruU2zrcQVwZuIOZ2tlzLMGRuVR+FykL04z5MEAwIvEq6UJxD2EImRwJGxDQ0W+ew5caypzyXIqJLA==",
"license": "Apache-2.0",
"dependencies": {
"@emotion/css": "11.13.5",
"@floating-ui/react": "0.27.12",
- "@thunderid/browser": "^1.3.0",
- "dompurify": "3.4.13",
+ "@thunderid/browser": "^1.27.0",
+ "dompurify": "3.4.17",
"tslib": "2.8.1"
},
"peerDependencies": {
@@ -1405,9 +1405,9 @@
}
},
"node_modules/@thunderid/react-router": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@thunderid/react-router/-/react-router-1.3.0.tgz",
- "integrity": "sha512-eDrOG7xBdkolS9VV5sbGKrKwplppIyivryOYphLa9gwJ128Rynrg2SKbOj8oHo1CVSvRMihgFoYyQkzbNACtTg==",
+ "version": "1.24.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/react-router/-/react-router-1.24.0.tgz",
+ "integrity": "sha512-HKfeZOqSjquKRDGZ2cZqRJTSK3ywnaD87Z+vx2ggcOzI8nhv3ZnwexiCLe/jtiZ5JRboweUIK8SfIoAn/TmW0A==",
"license": "Apache-2.0",
"dependencies": {
"tslib": "2.8.1"
diff --git a/quickstarts/quickstart-react/package.json b/quickstarts/quickstart-react/package.json
index e8ee19e..bfd6d52 100644
--- a/quickstarts/quickstart-react/package.json
+++ b/quickstarts/quickstart-react/package.json
@@ -10,8 +10,8 @@
"preview": "vite preview"
},
"dependencies": {
- "@thunderid/react": "1.4.0",
- "@thunderid/react-router": "1.3.0",
+ "@thunderid/react": "latest",
+ "@thunderid/react-router": "latest",
"react": "^19.2.9",
"react-dom": "^19.2.9",
"react-router": "^7.18.2"
diff --git a/quickstarts/quickstart-vue/package-lock.json b/quickstarts/quickstart-vue/package-lock.json
index 9f3d35e..08f7f72 100644
--- a/quickstarts/quickstart-vue/package-lock.json
+++ b/quickstarts/quickstart-vue/package-lock.json
@@ -8,7 +8,7 @@
"name": "@thunderid/quickstart-vue-sample",
"version": "1.0.1",
"dependencies": {
- "@thunderid/vue": "1.4.0",
+ "@thunderid/vue": "latest",
"vue": "^3.5.13"
},
"devDependencies": {
@@ -920,12 +920,12 @@
]
},
"node_modules/@thunderid/browser": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.3.0.tgz",
- "integrity": "sha512-O6DHlUyVFfBaNcJDEXACLU4NJMrNjDlqAuzesvJ+8a0Gl5g8WFK53rpx027e/rWICG0vcGe2UVZuhvZq5Z511A==",
+ "version": "1.27.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.27.0.tgz",
+ "integrity": "sha512-WLtyzL+vx8Z4faaw+CtVHTwaBUZj4MkZzmPpUVZLOQSYuV1b7zRiTTpUUhqkSG/TCMMg78gjDDQDGh2yTF4yqg==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.4.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"buffer": "6.0.3",
"core-js": "3.42.0",
@@ -938,9 +938,9 @@
}
},
"node_modules/@thunderid/javascript": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.4.0.tgz",
- "integrity": "sha512-qHfIFzXOQTN1nhuBT91Tr8bLPvfyEDa7gUQSL7GNcJkcyyKfJ77meIwr91lCme0ySFUnTeKl0Bk+R8iIJiKXBw==",
+ "version": "1.28.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.28.0.tgz",
+ "integrity": "sha512-IIJimiNPJCzFeDIw72tYwr2KkEE0vygvHt03DSTfsOoNp/nR0RjMyoP+BFh1+VRLGtb5DucdCJt1UnbnD/0bOw==",
"license": "Apache-2.0",
"dependencies": {
"jose": "6.2.3",
@@ -948,13 +948,13 @@
}
},
"node_modules/@thunderid/vue": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/@thunderid/vue/-/vue-1.4.0.tgz",
- "integrity": "sha512-a/38OLJOb7vfyTgRsrbxh1SaDpoWRok9dg0nHO0KPjy5uKSHIEFKaPgbthd879zuuC0Pfm1jcovr3E5gmjtZ0w==",
+ "version": "1.26.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/vue/-/vue-1.26.0.tgz",
+ "integrity": "sha512-tGAmDlh16LyGkxowqxDYmD/VwRzqrCiUrbdRsqlmvh6/gNaJanK4HnTOA4kiRDuFQ0h/G8VAnMQ2EXNvmm952w==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/browser": "^1.3.0",
- "dompurify": "3.4.13",
+ "@thunderid/browser": "^1.27.0",
+ "dompurify": "3.4.17",
"tslib": "2.8.1"
},
"peerDependencies": {
@@ -1498,9 +1498,9 @@
}
},
"node_modules/string_decoder": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
- "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.4.0.tgz",
+ "integrity": "sha512-r8azg21Y67ckRmeG0hHol5CeDXMs4ZFkFT6eXMO39hX7khvJcopBcYTCeWZ0rQXkMoPh8lVdbjmsOMGL8krxRQ==",
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.2.0"
diff --git a/quickstarts/quickstart-vue/package.json b/quickstarts/quickstart-vue/package.json
index c7f9069..ae689c7 100644
--- a/quickstarts/quickstart-vue/package.json
+++ b/quickstarts/quickstart-vue/package.json
@@ -10,7 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
- "@thunderid/vue": "1.4.0",
+ "@thunderid/vue": "latest",
"vue": "^3.5.13"
},
"devDependencies": {
diff --git a/self-service/myaccount-react/package-lock.json b/self-service/myaccount-react/package-lock.json
index 38ba2a5..58257ac 100644
--- a/self-service/myaccount-react/package-lock.json
+++ b/self-service/myaccount-react/package-lock.json
@@ -9,15 +9,15 @@
"version": "1.0.1",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/react": "1.1.0",
- "@thunderid/react-router": "1.1.0",
+ "@thunderid/react": "latest",
+ "@thunderid/react-router": "latest",
"react": "19.2.9",
"react-dom": "19.2.9",
"react-router": "8.3.0"
},
"devDependencies": {
- "@thunderid/eslint-plugin": "1.0.1",
- "@thunderid/prettier-config": "1.0.1",
+ "@thunderid/eslint-plugin": "latest",
+ "@thunderid/prettier-config": "latest",
"@types/node": "24.7.2",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
@@ -1123,12 +1123,12 @@
"license": "MIT"
},
"node_modules/@thunderid/browser": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.3.0.tgz",
- "integrity": "sha512-O6DHlUyVFfBaNcJDEXACLU4NJMrNjDlqAuzesvJ+8a0Gl5g8WFK53rpx027e/rWICG0vcGe2UVZuhvZq5Z511A==",
+ "version": "1.27.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/browser/-/browser-1.27.0.tgz",
+ "integrity": "sha512-WLtyzL+vx8Z4faaw+CtVHTwaBUZj4MkZzmPpUVZLOQSYuV1b7zRiTTpUUhqkSG/TCMMg78gjDDQDGh2yTF4yqg==",
"license": "Apache-2.0",
"dependencies": {
- "@thunderid/javascript": "^1.4.0",
+ "@thunderid/javascript": "^1.28.0",
"base64url": "3.0.1",
"buffer": "6.0.3",
"core-js": "3.42.0",
@@ -1175,9 +1175,9 @@
}
},
"node_modules/@thunderid/javascript": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.4.0.tgz",
- "integrity": "sha512-qHfIFzXOQTN1nhuBT91Tr8bLPvfyEDa7gUQSL7GNcJkcyyKfJ77meIwr91lCme0ySFUnTeKl0Bk+R8iIJiKXBw==",
+ "version": "1.28.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/javascript/-/javascript-1.28.0.tgz",
+ "integrity": "sha512-IIJimiNPJCzFeDIw72tYwr2KkEE0vygvHt03DSTfsOoNp/nR0RjMyoP+BFh1+VRLGtb5DucdCJt1UnbnD/0bOw==",
"license": "Apache-2.0",
"dependencies": {
"jose": "6.2.3",
@@ -1195,15 +1195,15 @@
}
},
"node_modules/@thunderid/react": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.1.0.tgz",
- "integrity": "sha512-fvm3XvoDcnXA1WYkLjgkfsaK0rpXdrE54Su031YlZlNxYW95nw2Th8pp8WzylmAlbr6OBuPdDWDB27NbGs88Dw==",
+ "version": "1.29.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/react/-/react-1.29.0.tgz",
+ "integrity": "sha512-a4XX5xo+iruU2zrcQVwZuIOZ2tlzLMGRuVR+FykL04z5MEAwIvEq6UJxD2EImRwJGxDQ0W+ew5caypzyXIqJLA==",
"license": "Apache-2.0",
"dependencies": {
"@emotion/css": "11.13.5",
"@floating-ui/react": "0.27.12",
- "@thunderid/browser": "^1.1.0",
- "dompurify": "3.4.13",
+ "@thunderid/browser": "^1.27.0",
+ "dompurify": "3.4.17",
"tslib": "2.8.1"
},
"peerDependencies": {
@@ -1213,9 +1213,9 @@
}
},
"node_modules/@thunderid/react-router": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@thunderid/react-router/-/react-router-1.1.0.tgz",
- "integrity": "sha512-B808PU4duF1fCByy1WcHGJXMQtIPsKbRyoMOkw9+dm29Qz9a55qL+ZurpUP1kQIXm9Smt9fAg7MqL2jIQrT27g==",
+ "version": "1.24.0",
+ "resolved": "https://registry.npmjs.org/@thunderid/react-router/-/react-router-1.24.0.tgz",
+ "integrity": "sha512-HKfeZOqSjquKRDGZ2cZqRJTSK3ywnaD87Z+vx2ggcOzI8nhv3ZnwexiCLe/jtiZ5JRboweUIK8SfIoAn/TmW0A==",
"license": "Apache-2.0",
"dependencies": {
"tslib": "2.8.1"
diff --git a/self-service/myaccount-react/package.json b/self-service/myaccount-react/package.json
index 5cf34c4..f59bda6 100644
--- a/self-service/myaccount-react/package.json
+++ b/self-service/myaccount-react/package.json
@@ -15,15 +15,15 @@
"format:fix": "prettier --write --cache ."
},
"dependencies": {
- "@thunderid/react": "1.1.0",
- "@thunderid/react-router": "1.1.0",
+ "@thunderid/react": "latest",
+ "@thunderid/react-router": "latest",
"react": "19.2.9",
"react-dom": "19.2.9",
"react-router": "8.3.0"
},
"devDependencies": {
- "@thunderid/eslint-plugin": "1.0.1",
- "@thunderid/prettier-config": "1.0.1",
+ "@thunderid/eslint-plugin": "latest",
+ "@thunderid/prettier-config": "latest",
"@types/node": "24.7.2",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
diff --git a/tests/e2e/.gitignore b/tests/e2e/.gitignore
new file mode 100644
index 0000000..3948721
--- /dev/null
+++ b/tests/e2e/.gitignore
@@ -0,0 +1,11 @@
+# ThunderID release downloaded by shared/scripts/thunderid.sh.
+.thunderid-server/
+
+# Playwright output
+playwright-report/
+test-results/
+blob-report/
+
+# Maestro output
+report.xml
+app.log
diff --git a/tests/e2e/.prettierignore b/tests/e2e/.prettierignore
new file mode 100644
index 0000000..350d5e1
--- /dev/null
+++ b/tests/e2e/.prettierignore
@@ -0,0 +1,12 @@
+node_modules
+package-lock.json
+playwright-report
+test-results
+blob-report
+.thunderid-server
+# Go template and YAML hybrids (ThunderID's declarative /import format), valid YAML only once the
+# placeholders are rendered on the server.
+shared/thunderid-config/*.yaml
+# Maestro output.
+*/*-e2e/report.xml
+*/*-e2e/app.log
diff --git a/tests/e2e/README.md b/tests/e2e/README.md
new file mode 100644
index 0000000..2cd3445
--- /dev/null
+++ b/tests/e2e/README.md
@@ -0,0 +1,109 @@
+# Sample App E2E Tests
+
+End-to-end tests for the sample apps in this repository, one suite per app. Each suite starts its sample from the sources here, with the published SDK release the sample's lockfile pins, and drives it against a real ThunderID server.
+
+## Layout
+
+```text
+tests/e2e/
+├── package.json npm workspace root: shared + every web suite, one package-lock.json
+├── shared/ What every suite shares
+│ ├── scripts/thunderid.sh Start, stop and restart a ThunderID server; mint an admin token;
+│ │ import a declarative config; create a user
+│ ├── scripts/mobile.sh Provisioning, simulator and Maestro helpers for the mobile suites
+│ ├── thunderid-config/ sample-apps.yaml (+ .env): the OAuth2 clients of the web samples that
+│ │ ship no config of their own, and the CORS allowlist
+│ ├── apps.ts Each web sample: path, port, configs to import, test users
+│ ├── playwright.ts The shared Playwright config and the sample web server
+│ ├── setup/ Global setup: import the configs, create the test users (idempotent)
+│ ├── pages/ Gate sign-in, the SDK sample pages, B2B company sign-up
+│ └── utils/ Admin token, API requests, users, organization units, JWT
+└── /-e2e/ One suite per sample, mirroring its path in this repository
+```
+
+| Suite | Kind | Port | Runs in CI |
+| --------------------------------------- | --------------------------- | ---------------------- | ---------- |
+| `quickstarts/quickstart-browser-e2e` | Playwright | 5173 | Yes |
+| `quickstarts/quickstart-react-e2e` | Playwright | 5174 | Yes |
+| `quickstarts/quickstart-vue-e2e` | Playwright | 5175 | Yes |
+| `quickstarts/quickstart-nextjs-e2e` | Playwright | 3001 | Yes |
+| `quickstarts/quickstart-nuxt-e2e` | Playwright | 3002 | Yes |
+| `quickstarts/quickstart-express-e2e` | Playwright | 3000 | Yes |
+| `quickstarts/quickstart-node-e2e` | Playwright (spawns the CLI) | none | Yes |
+| `quickstarts/quickstart-react-b2b-e2e` | Playwright | 5173 | No |
+| `quickstarts/quickstart-nextjs-b2b-e2e` | Playwright | 3000 | No |
+| `b2b/wayfinder-enterprise-nextjs-e2e` | Playwright | 3000 | No |
+| `management/admin-react-e2e` | Playwright | 5176 | Yes |
+| `self-service/myaccount-react-e2e` | Playwright | 5177 | Yes |
+| `patterns/bff-react-express-e2e` | Playwright | 5178 (app), 3004 (BFF) | Yes |
+| `integrations/better-auth-nextjs-e2e` | Playwright | 3003 | Yes |
+| `quickstarts/quickstart-ios-e2e` | Maestro, iOS Simulator | | No |
+| `quickstarts/quickstart-android-e2e` | Maestro, Android emulator | | No |
+| `quickstarts/quickstart-flutter-e2e` | Maestro, iOS Simulator | | No |
+| `integrations/app-auth-flutter-e2e` | Maestro, iOS Simulator | | No |
+
+The ports are where each suite serves its sample. Most are distinct, so those suites can run side by side against one server. A few are fixed by the sample itself: `quickstart-browser` and `quickstart-react-b2b` both need 5173, and `quickstart-express`, `quickstart-nextjs-b2b` and `wayfinder-enterprise-nextjs` all need 3000, so run those one at a time. The Nuxt redirect URI fixes 3002.
+
+## Prerequisites
+
+- Node.js 22.18 or later, and npm
+- Bash, `curl`, `jq`, `openssl` and `unzip`, for the server script
+- A ThunderID server at `https://localhost:8090` (override with `SERVER_URL`), with the admin account `admin` / `admin` (override with `ADMIN_USERNAME` and `ADMIN_PASSWORD`). The B2B suites (`quickstart-react-b2b`, `quickstart-nextjs-b2b`, `wayfinder-enterprise-nextjs`) need a server newer than ThunderID 1.1.1: their samples use features such as the `org` permission.
+
+## Start a server
+
+```bash
+# Downloads the latest release (or THUNDERID_VERSION) into .thunderid-server/, sets it up and starts it.
+# Reuses a server that is already serving on SERVER_URL.
+./shared/scripts/thunderid.sh start
+
+./shared/scripts/thunderid.sh stop
+```
+
+## Run the web suites
+
+```bash
+npm ci
+npx playwright install chromium
+
+# One suite
+npm test -w quickstarts/quickstart-react-e2e
+
+# Every web suite, one after another
+npm test
+```
+
+A suite's global setup imports what its app needs (`shared/thunderid-config/sample-apps.yaml`, and for the B2B samples their own `thunderid-config/thunderid-config.yaml`) and creates the test users, so it works against a fresh server and against one a previous run provisioned. Playwright then starts the sample with its own `npm run dev` or `npm start`, running `npm ci` in it first when it has no `node_modules`, and passes the sample its configuration through the environment, so nothing is written into the sample.
+
+| Variable | Default | Purpose |
+| ------------------------------------------ | ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
+| `SAMPLES_ROOT` | this repository | The samples checkout to run, such as a `git archive HEAD` export when your working tree has local edits |
+| `SERVER_URL` | `https://localhost:8090` | The ThunderID server |
+| `ADMIN_USERNAME`, `ADMIN_PASSWORD` | `admin`, `admin` | The admin account the setup uses, and that the admin-react suite signs in as |
+| `ADMIN_TOKEN` | unset | Use this admin token instead of minting one |
+| `TEST_USER_USERNAME`, `TEST_USER_PASSWORD` | `e2e-test-user`, `E2ePassword@123` | The shared test user |
+| `E2E_SKIP_SERVER_CONFIGS` | unset | `true` leaves server-wide settings (`defaultResourceServer`) out of the B2B samples' imports, for a server other people use |
+| `E2E_REUSE_SERVER` | unset | `true` reuses an app already listening on the suite's port instead of failing |
+| `E2E_APP_LOGS` | unset | `true` prints the sample's output |
+| `E2E_WORKERS` | `2` | Parallel Playwright workers. Kept low because the server's SQLite store can refuse racing authorization code exchanges |
+
+Defaults live in `shared/defaults.env`; a `tests/e2e/.env` file overrides them.
+
+The suites leave what they create on the server: the test users, the imported resources, and the companies the B2B suites register. Use a disposable server for the B2B suites, whose imports also change the server-wide `defaultResourceServer` setting.
+
+## Run the mobile suites
+
+Each mobile suite has a `run-e2e.sh` that starts or reuses the server with `shared/scripts/thunderid.sh`, provisions it, builds and installs the sample, and runs Maestro. See the suite's README. The SDK repositories' Windows scripts are not ported.
+
+## CI
+
+[`.github/workflows/e2e.yml`](../../.github/workflows/e2e.yml) runs a web suite on a pull request when its sample, its suite, or `tests/e2e/shared` changes. Each suite gets its own job and a fresh server of the latest ThunderID release, and uploads its Playwright report when it fails. The mobile suites are not in CI yet; adding them is a follow-up.
+
+A suite whose sample needs more than the latest ThunderID release offers carries a `ci-skip` file with the reason, and CI leaves it out. The B2B suites have one, because the latest release rejects their samples' configuration. Delete the file once a release supports the sample.
+
+## Formatting
+
+```bash
+npm run format:check
+npm run type-check
+```
diff --git a/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/README.md b/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/README.md
new file mode 100644
index 0000000..a5dbfe8
--- /dev/null
+++ b/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/README.md
@@ -0,0 +1,21 @@
+# ThunderID Wayfinder Enterprise Sample E2E
+
+Playwright suite for [`b2b/wayfinder-enterprise-nextjs`](../../../../b2b/wayfinder-enterprise-nextjs). It starts the sample from its own sources with its published SDK, signs in against a real ThunderID server, and checks:
+
+- A new company's first admin lands in the admin workspace with every admin page
+- Team and roles lists the admin through the app's company-scoped management proxy
+- Sign-out
+
+## Run
+
+Start a ThunderID server first (see the [E2E README](../../README.md)), then, from `tests/e2e`:
+
+```bash
+npm ci
+npx playwright install chromium
+npm test -w b2b/wayfinder-enterprise-nextjs-e2e
+```
+
+Playwright installs the sample with `npm ci` when it has no `node_modules`, and serves it on port 3000 with the sample's own OAuth2 clients `WAYFINDER_ENTERPRISE` and `WAYFINDER_ENTERPRISE_BACKEND`. The global setup imports that client and creates the test users. Set `SAMPLES_ROOT` to run against another samples checkout, such as a `git archive` export.
+
+The global setup imports the sample's own `thunderid-config/thunderid-config.yaml`, which needs a ThunderID server newer than 1.1.1, and sets the server-wide `defaultResourceServer` to the Wayfinder API. The app needs that setting, so do not use `E2E_SKIP_SERVER_CONFIGS` here, and run it against a disposable server. `npm run dev` fixes port 3000, shared with `quickstart-express` and `quickstart-nextjs-b2b`. Every run registers a new company, which stays on the server.
diff --git a/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/ci-skip b/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/ci-skip
new file mode 100644
index 0000000..7a45cea
--- /dev/null
+++ b/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/ci-skip
@@ -0,0 +1 @@
+Needs a ThunderID server built from main: the latest release rejects this sample's configuration (organization unit permissions and flows). Remove this file once a release supports it.
diff --git a/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/fixtures.ts b/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/fixtures.ts
new file mode 100644
index 0000000..043bade
--- /dev/null
+++ b/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/fixtures.ts
@@ -0,0 +1,13 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {test as base} from '@playwright/test';
+import {WayfinderPage} from './pages/wayfinder.page.ts';
+
+export const test = base.extend<{wayfinderPage: WayfinderPage}>({
+ wayfinderPage: async ({page}, use) => {
+ await use(new WayfinderPage(page));
+ },
+});
+
+export {expect} from '@playwright/test';
diff --git a/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/package.json b/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/package.json
new file mode 100644
index 0000000..616f45b
--- /dev/null
+++ b/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@thunderid/wayfinder-enterprise-nextjs-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "E2E suite of b2b/wayfinder-enterprise-nextjs",
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+}
diff --git a/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/pages/wayfinder.page.ts b/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/pages/wayfinder.page.ts
new file mode 100644
index 0000000..d84124c
--- /dev/null
+++ b/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/pages/wayfinder.page.ts
@@ -0,0 +1,45 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * b2b/wayfinder-enterprise-nextjs Page Object: the landing page's "Get started", and the workspace
+ * shell (src/components/WorkspaceShell.tsx), which gives an admin a sidebar of admin pages and a
+ * member the booking page only.
+ */
+
+import {type Locator, expect} from '@playwright/test';
+import {Timeouts} from '../../../shared/constants/timeouts.ts';
+import {B2BGatePage} from '../../../shared/pages/b2b-gate.page.ts';
+
+export const ADMIN_PAGES = ['Flight booking', 'Travel policy', 'Team and roles', 'Enterprise SSO'];
+
+export class WayfinderPage extends B2BGatePage {
+ async goto(url: string): Promise {
+ // Server-rendered: wait for hydration, or the first click is lost.
+ await this.page.goto(url, {waitUntil: 'networkidle'});
+ }
+
+ async clickSignInButton(): Promise {
+ await this.page.getByRole('button', {name: 'Get started'}).first().click();
+ }
+
+ sidebarLink(label: string): Locator {
+ return this.page.locator('aside').getByRole('link', {name: label});
+ }
+
+ async verifyAdminWorkspace(companyName: string): Promise {
+ await expect(this.sidebarLink('Flight booking')).toBeVisible({timeout: Timeouts.REDIRECT});
+ await expect(this.page.getByText(companyName).first()).toBeVisible();
+ }
+
+ async logout(): Promise {
+ await this.page.getByRole('button', {exact: true, name: 'Sign out'}).click();
+ await this.page.waitForLoadState('networkidle');
+ }
+
+ async verifyLoggedOut(): Promise {
+ await expect(this.page.getByRole('button', {name: 'Get started'}).first()).toBeVisible({
+ timeout: Timeouts.REDIRECT,
+ });
+ }
+}
diff --git a/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/playwright.config.ts b/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/playwright.config.ts
new file mode 100644
index 0000000..6178bd9
--- /dev/null
+++ b/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/playwright.config.ts
@@ -0,0 +1,43 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {randomBytes} from 'node:crypto';
+import {defineSampleConfig, sampleWebServer} from '../../shared/playwright.ts';
+
+// The sample's `npm run dev` fixes port 3000. Its own thunderid-config (imported by the global
+// setup) creates the resources with fixed IDs; the two client secrets match the ones shared/apps.ts
+// imports.
+const appUrl = 'http://localhost:3000';
+
+const config = defineSampleConfig({
+ app: 'WAYFINDER_ENTERPRISE_NEXTJS',
+ webServer: sampleWebServer('WAYFINDER_ENTERPRISE_NEXTJS', {
+ command: 'npm run dev',
+ env: {
+ NEXT_PUBLIC_THUNDERID_AFTER_SIGN_IN_URL: appUrl,
+ NEXT_PUBLIC_THUNDERID_AFTER_SIGN_OUT_URL: appUrl,
+ NEXT_PUBLIC_THUNDERID_APPLICATION_ID: '019f0a10-0000-7000-8000-000000000031',
+ NEXT_PUBLIC_THUNDERID_BASE_URL: process.env.SERVER_URL!,
+ NEXT_PUBLIC_THUNDERID_CLIENT_ID: 'WAYFINDER_ENTERPRISE',
+ NEXT_PUBLIC_THUNDERID_SCOPES:
+ 'openid profile email roles ou booking:view booking:create booking:manage policy:view policy:manage user:view user:manage group:view group:manage role:view role:manage sso:view sso:manage',
+ // The app calls ThunderID from its server; accept the local server's self-signed certificate.
+ NODE_TLS_REJECT_UNAUTHORIZED: '0',
+ THUNDERID_CLIENT_SECRET: 'e2e-wayfinder-secret',
+ THUNDERID_SESSION_SECRET: randomBytes(32).toString('base64'),
+ THUNDERID_SYSTEM_RESOURCE: `${process.env.SERVER_URL}/mcp`,
+ WAYFINDER_ADMIN_ROLE_ID: '019f0a10-0000-7000-8000-000000000011',
+ WAYFINDER_ADMIN_ROLE_NAME: 'Wayfinder Admin',
+ WAYFINDER_API_RESOURCE: 'urn:wayfinder-enterprise:api',
+ WAYFINDER_APP_URL: appUrl,
+ WAYFINDER_BACKEND_CLIENT_ID: 'WAYFINDER_ENTERPRISE_BACKEND',
+ WAYFINDER_BACKEND_CLIENT_SECRET: 'e2e-wayfinder-backend-secret',
+ WAYFINDER_MEMBER_ROLE_ID: '019f0a10-0000-7000-8000-000000000012',
+ WAYFINDER_SIGN_IN_FLOW_ID: '019f0a10-0000-7000-8000-000000000021',
+ WAYFINDER_USER_TYPE: 'wayfinder-user',
+ },
+ url: appUrl,
+ }),
+});
+
+export default config;
diff --git a/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/tests/workspace.spec.ts b/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/tests/workspace.spec.ts
new file mode 100644
index 0000000..48ea342
--- /dev/null
+++ b/tests/e2e/b2b/wayfinder-enterprise-nextjs-e2e/tests/workspace.spec.ts
@@ -0,0 +1,49 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * b2b/wayfinder-enterprise-nextjs - a company registers, its first admin lands in the admin
+ * workspace, reads the company's team through the app's company-scoped management proxy
+ * (/api/admin), and signs out. Every run registers a new company; it stays on the server.
+ *
+ * Needs the sample's defaultResourceServer server config (its tokens carry the Wayfinder
+ * permissions only through it), so it cannot run with E2E_SKIP_SERVER_CONFIGS=true.
+ */
+
+import {SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {Timeouts} from '../../../shared/constants/timeouts.ts';
+import {type Company, newCompany} from '../../../shared/pages/b2b-gate.page.ts';
+import {expect, test} from '../fixtures.ts';
+import {ADMIN_PAGES} from '../pages/wayfinder.page.ts';
+
+const appUrl = sampleAppUrl(SampleApps.WAYFINDER_ENTERPRISE_NEXTJS);
+
+test.describe('b2b/wayfinder-enterprise-nextjs - Company workspace', () => {
+ let company: Company;
+
+ test.beforeEach(async ({wayfinderPage}) => {
+ company = newCompany('wayfinder');
+ await wayfinderPage.goto(appUrl);
+ await wayfinderPage.clickSignInButton();
+ await wayfinderPage.registerCompany(company);
+ await wayfinderPage.verifyAdminWorkspace(company.name);
+ });
+
+ test('TC001: the first admin of a new company gets every admin page', async ({wayfinderPage}) => {
+ for (const label of ADMIN_PAGES) {
+ await expect(wayfinderPage.sidebarLink(label)).toBeVisible();
+ }
+ });
+
+ test('TC002: Team and roles lists the company admin through the management proxy', async ({page, wayfinderPage}) => {
+ await wayfinderPage.sidebarLink('Team and roles').click();
+ await expect(page).toHaveURL(/\/workspace\/team/);
+ await expect(page.getByText(company.username).first()).toBeVisible({timeout: Timeouts.REDIRECT});
+ });
+
+ test('TC003: signs out of the workspace', async ({wayfinderPage}) => {
+ await wayfinderPage.logout();
+ await wayfinderPage.goto(appUrl);
+ await wayfinderPage.verifyLoggedOut();
+ });
+});
diff --git a/tests/e2e/integrations/app-auth-flutter-e2e/README.md b/tests/e2e/integrations/app-auth-flutter-e2e/README.md
new file mode 100644
index 0000000..07adf98
--- /dev/null
+++ b/tests/e2e/integrations/app-auth-flutter-e2e/README.md
@@ -0,0 +1,26 @@
+# ThunderID Flutter AppAuth Integration E2E
+
+Maestro flows that drive [`integrations/app-auth-flutter`](../../../../integrations/app-auth-flutter) on an iOS Simulator. The sample signs in with [flutter_appauth](https://pub.dev/packages/flutter_appauth): the ThunderID Gate opens in the system browser, and the app gets the tokens with the authorization code and PKCE.
+
+| Flow | What it checks |
+| -------------------- | ----------------------------------------------------------------------------- |
+| `flows/signin.yaml` | Sign in on the Gate, see the signed-in screen, sign out (RP-initiated logout) |
+| `flows/refresh.yaml` | Refresh the tokens with the refresh token, without the browser |
+
+## Prerequisites
+
+Flutter, Xcode (with an iPhone simulator), [Maestro](https://maestro.mobile.dev/getting-started/installing-maestro), `curl`, `jq`, `openssl`, `unzip`.
+
+## Run
+
+```bash
+./run-e2e.sh
+./run-e2e.sh --skip-server --skip-build
+./run-e2e.sh flows/signin.yaml
+```
+
+`run-e2e.sh` uses [`shared/scripts/thunderid.sh`](../../shared/scripts/thunderid.sh) to start or reuse the server, imports this folder's [`thunderid-config.yaml`](./thunderid-config.yaml) (a public client `SAMPLES_E2E_APP_AUTH_FLUTTER` with the sample's `com.example.appauth://` redirect URIs), creates the test user `e2e_mobile_user` / `TestPassword@123`, adds the server's certificate to the simulator's trusted roots, and builds the sample with `--dart-define=THUNDERID_CLIENT_ID=...`. Set `SAMPLES_ROOT` to build from another samples checkout.
+
+The flows drive the Gate's sign-in page inside the system browser (Safari) by its placeholders and the keyboard's Next and return keys, since a tap there does not reliably move the focus. Android is not covered: it needs the server's certificate installed on the emulator by hand (see the sample's README).
+
+These suites do not run in CI yet; adding them is a follow-up.
diff --git a/tests/e2e/integrations/app-auth-flutter-e2e/flows/config.yaml b/tests/e2e/integrations/app-auth-flutter-e2e/flows/config.yaml
new file mode 100644
index 0000000..f33d20f
--- /dev/null
+++ b/tests/e2e/integrations/app-auth-flutter-e2e/flows/config.yaml
@@ -0,0 +1,4 @@
+# Maestro workspace configuration. Only the top-level flows are tests; subflows/ holds the shared
+# building blocks they run.
+flows:
+ - '*.yaml'
diff --git a/tests/e2e/integrations/app-auth-flutter-e2e/flows/refresh.yaml b/tests/e2e/integrations/app-auth-flutter-e2e/flows/refresh.yaml
new file mode 100644
index 0000000..d18a97e
--- /dev/null
+++ b/tests/e2e/integrations/app-auth-flutter-e2e/flows/refresh.yaml
@@ -0,0 +1,21 @@
+appId: com.example.flutterAppauthSample
+name: Refresh the tokens with the refresh token
+tags:
+ - auth
+env:
+ E2E_USERNAME: e2e_mobile_user
+ E2E_PASSWORD: TestPassword@123
+---
+- launchApp:
+ clearState: true
+- runFlow: subflows/ensure-signed-out.yaml
+- runFlow: subflows/sign-in.yaml
+
+# A refresh replaces the tokens without the browser and keeps the session.
+- tapOn: 'Refresh tokens'
+- extendedWaitUntil:
+ visible: 'Signed in as.*'
+ timeout: 20000
+- assertNotVisible: '.*[Ee]rror.*'
+
+- runFlow: subflows/sign-out.yaml
diff --git a/tests/e2e/integrations/app-auth-flutter-e2e/flows/signin.yaml b/tests/e2e/integrations/app-auth-flutter-e2e/flows/signin.yaml
new file mode 100644
index 0000000..dffdbae
--- /dev/null
+++ b/tests/e2e/integrations/app-auth-flutter-e2e/flows/signin.yaml
@@ -0,0 +1,19 @@
+appId: com.example.flutterAppauthSample
+name: Sign in and sign out through the ThunderID Gate
+tags:
+ - auth
+env:
+ E2E_USERNAME: e2e_mobile_user
+ E2E_PASSWORD: TestPassword@123
+---
+- launchApp:
+ clearState: true
+- runFlow: subflows/ensure-signed-out.yaml
+
+- runFlow: subflows/sign-in.yaml
+
+# The app shows the ID token's claims and the token expiry once flutter_appauth has the tokens.
+- assertVisible: 'Access token expires.*'
+- assertVisible: 'Refresh tokens'
+
+- runFlow: subflows/sign-out.yaml
diff --git a/tests/e2e/integrations/app-auth-flutter-e2e/flows/subflows/continue-system-prompt.yaml b/tests/e2e/integrations/app-auth-flutter-e2e/flows/subflows/continue-system-prompt.yaml
new file mode 100644
index 0000000..098817b
--- /dev/null
+++ b/tests/e2e/integrations/app-auth-flutter-e2e/flows/subflows/continue-system-prompt.yaml
@@ -0,0 +1,14 @@
+appId: com.example.flutterAppauthSample
+---
+# iOS asks before an app opens an authentication session ("... Wants to Use ... to Sign In"). It
+# is a system alert, so dismiss it when it shows rather than wait for it.
+- repeat:
+ times: 3
+ commands:
+ - runFlow:
+ when:
+ visible: 'Continue'
+ commands:
+ - tapOn: 'Continue'
+ - waitForAnimationToEnd:
+ timeout: 750
diff --git a/tests/e2e/integrations/app-auth-flutter-e2e/flows/subflows/ensure-signed-out.yaml b/tests/e2e/integrations/app-auth-flutter-e2e/flows/subflows/ensure-signed-out.yaml
new file mode 100644
index 0000000..30bc379
--- /dev/null
+++ b/tests/e2e/integrations/app-auth-flutter-e2e/flows/subflows/ensure-signed-out.yaml
@@ -0,0 +1,12 @@
+appId: com.example.flutterAppauthSample
+---
+# The app restores a stored session on launch, and secure storage on iOS can outlive clearState,
+# so sign out first when a session is showing.
+- runFlow:
+ when:
+ visible: 'Signed in as.*'
+ commands:
+ - runFlow: sign-out.yaml
+- extendedWaitUntil:
+ visible: 'Sign in'
+ timeout: 20000
diff --git a/tests/e2e/integrations/app-auth-flutter-e2e/flows/subflows/sign-in.yaml b/tests/e2e/integrations/app-auth-flutter-e2e/flows/subflows/sign-in.yaml
new file mode 100644
index 0000000..00f69e6
--- /dev/null
+++ b/tests/e2e/integrations/app-auth-flutter-e2e/flows/subflows/sign-in.yaml
@@ -0,0 +1,24 @@
+appId: com.example.flutterAppauthSample
+---
+# Signs in with E2E_USERNAME and E2E_PASSWORD on the ThunderID Gate, which flutter_appauth opens in
+# the system browser, and waits until the app is back with a session.
+- tapOn: 'Sign in'
+- runFlow: continue-system-prompt.yaml
+
+# The Gate renders its sign-in form from the application's flow. A tap on a field in Safari does not
+# reliably move the focus, so move between the fields with the keyboard's Next button.
+- extendedWaitUntil:
+ visible: 'Enter your password'
+ timeout: 60000
+- waitForAnimationToEnd:
+ timeout: 3000
+- tapOn: 'Enter your username'
+- inputText: ${E2E_USERNAME}
+- tapOn: 'Next'
+- inputText: ${E2E_PASSWORD}
+# Submit with the return key: the keyboard covers the Sign In button.
+- pressKey: Enter
+
+- extendedWaitUntil:
+ visible: 'Signed in as.*'
+ timeout: 30000
diff --git a/tests/e2e/integrations/app-auth-flutter-e2e/flows/subflows/sign-out.yaml b/tests/e2e/integrations/app-auth-flutter-e2e/flows/subflows/sign-out.yaml
new file mode 100644
index 0000000..8effb68
--- /dev/null
+++ b/tests/e2e/integrations/app-auth-flutter-e2e/flows/subflows/sign-out.yaml
@@ -0,0 +1,15 @@
+appId: com.example.flutterAppauthSample
+---
+# Ends the session at ThunderID (RP-initiated logout through the system browser) and waits for the
+# app's signed-out screen. The Gate may ask to confirm the sign-out.
+- tapOn: 'Sign out'
+- runFlow: continue-system-prompt.yaml
+- runFlow:
+ when:
+ visible: 'Sign out'
+ notVisible: 'Signed in as.*'
+ commands:
+ - tapOn: 'Sign out'
+- extendedWaitUntil:
+ visible: 'Sign in'
+ timeout: 30000
diff --git a/tests/e2e/integrations/app-auth-flutter-e2e/run-e2e.sh b/tests/e2e/integrations/app-auth-flutter-e2e/run-e2e.sh
new file mode 100755
index 0000000..03acb64
--- /dev/null
+++ b/tests/e2e/integrations/app-auth-flutter-e2e/run-e2e.sh
@@ -0,0 +1,87 @@
+#!/usr/bin/env bash
+# Copyright 2026 The ThunderID Authors
+# SPDX-License-Identifier: Apache-2.0
+#
+# Runs the integrations/app-auth-flutter E2E suite on an iOS Simulator: starts a ThunderID server
+# (or reuses one), registers the suite's OAuth2 client (thunderid-config.yaml) and test user, makes
+# the simulator trust the server's certificate, builds and installs the sample from this repository,
+# and drives it with Maestro. Every stage is idempotent.
+#
+# Usage:
+# ./run-e2e.sh Everything
+# ./run-e2e.sh --skip-server Server already running and provisioned
+# ./run-e2e.sh --skip-build Sample already installed on the simulator
+# ./run-e2e.sh flows/signin.yaml Run one flow instead of the whole suite
+#
+# Any other argument is passed through to Maestro.
+#
+# Environment:
+# SAMPLES_ROOT The samples checkout to build the sample from (default: this repository)
+# SIMULATOR_NAME Simulator to boot when none is booted (default iPhone 17, else any iPhone)
+# E2E_USERNAME Test user (default e2e_mobile_user)
+# E2E_PASSWORD Test user password (default TestPassword@123)
+# SERVER_URL, ADMIN_USERNAME, ADMIN_PASSWORD, THUNDERID_VERSION: see ../../shared/scripts/thunderid.sh
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+E2E_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
+THUNDERID="$E2E_ROOT/shared/scripts/thunderid.sh"
+SAMPLES_ROOT="${SAMPLES_ROOT:-$(cd "$E2E_ROOT/../.." && pwd)}"
+SAMPLE_DIR="$SAMPLES_ROOT/integrations/app-auth-flutter"
+
+export SERVER_URL="${SERVER_URL:-https://localhost:8090}"
+E2E_USER="${E2E_USERNAME:-e2e_mobile_user}"
+E2E_PASS="${E2E_PASSWORD:-TestPassword@123}"
+
+# Must match the clientId in thunderid-config.yaml.
+CLIENT_ID="SAMPLES_E2E_APP_AUTH_FLUTTER"
+
+do_server=true
+do_build=true
+maestro_args=()
+for arg in "$@"; do
+ case "$arg" in
+ --skip-server) do_server=false ;;
+ --skip-build) do_build=false ;;
+ -h | --help) sed -n '5,24p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
+ *) maestro_args+=("$arg") ;;
+ esac
+done
+
+# shellcheck source=../../shared/scripts/mobile.sh
+source "$E2E_ROOT/shared/scripts/mobile.sh"
+
+# The sample reaches the server through the system browser and flutter_appauth, which both reject
+# a self-signed certificate the simulator does not trust. Add the server's own certificate as a
+# root, read from the server itself so this works for a reused server too.
+trust_server_certificate() {
+ local hostport cert
+ hostport=$(sed -E 's#^[a-z]+://([^/]+).*#\1#' <<<"$SERVER_URL")
+ cert=$(mktemp)
+ # s_client exits non-zero when stdin closes, which pipefail would turn into a failure.
+ { openssl s_client -connect "$hostport" -showcerts /dev/null || true; } |
+ awk '/BEGIN CERTIFICATE/,/END CERTIFICATE/' >"$cert"
+ [ -s "$cert" ] || { echo "ERROR: could not read the certificate of $SERVER_URL." >&2; exit 1; }
+ echo "==> Trusting the server certificate on simulator $SIM_UDID"
+ xcrun simctl keychain "$SIM_UDID" add-root-cert "$cert"
+ rm -f "$cert"
+}
+
+build_sample() {
+ echo "==> Building and installing the sample"
+ (cd "$SAMPLE_DIR" && flutter pub get && flutter build ios --debug --simulator \
+ --dart-define=THUNDERID_CLIENT_ID="$CLIENT_ID" \
+ --dart-define=THUNDERID_ISSUER="$SERVER_URL")
+ xcrun simctl install "$SIM_UDID" "$SAMPLE_DIR/build/ios/iphonesimulator/Runner.app"
+}
+
+if $do_server; then
+ "$THUNDERID" start
+ "$THUNDERID" import "$SCRIPT_DIR/thunderid-config.yaml"
+ "$THUNDERID" ensure-user "$E2E_USER" "$E2E_PASS"
+fi
+resolve_simulator
+trust_server_certificate
+$do_build && build_sample
+run_flows --device "$SIM_UDID"
diff --git a/tests/e2e/integrations/app-auth-flutter-e2e/thunderid-config.yaml b/tests/e2e/integrations/app-auth-flutter-e2e/thunderid-config.yaml
new file mode 100644
index 0000000..0c9e18b
--- /dev/null
+++ b/tests/e2e/integrations/app-auth-flutter-e2e/thunderid-config.yaml
@@ -0,0 +1,50 @@
+# Copyright 2026 The ThunderID Authors
+# SPDX-License-Identifier: Apache-2.0
+#
+# OAuth2 client of the integrations/app-auth-flutter E2E suite: a public native client with PKCE,
+# redirecting to the sample's custom scheme. Imported by run-e2e.sh with `thunderid.sh import`.
+---
+resource_type: application
+id: 019a0000-0000-7000-8000-0000000000d1
+ouHandle: default
+name: E2E integrations/app-auth-flutter
+description: OAuth2 client for the app-auth-flutter sample's E2E suite
+type: mobile
+authFlowHandle: default-flow
+isRegistrationFlowEnabled: false
+isRecoveryFlowEnabled: false
+isSignOutFlowEnabled: false
+assertion:
+ validityPeriod: 3600
+loginConsent:
+ validityPeriod: 0
+allowedUserTypes:
+ - Person
+inboundAuthConfig:
+ - type: oauth2
+ config:
+ clientId: SAMPLES_E2E_APP_AUTH_FLUTTER
+ redirectUris:
+ - com.example.appauth://callback
+ postLogoutRedirectUris:
+ - com.example.appauth://logout
+ grantTypes:
+ - authorization_code
+ - refresh_token
+ responseTypes:
+ - code
+ tokenEndpointAuthMethod: none
+ pkceRequired: true
+ publicClient: true
+ token:
+ accessToken:
+ userConfig:
+ validityPeriod: 3600
+ attributes: [given_name, family_name, email]
+ idToken:
+ validityPeriod: 3600
+ userAttributes: [given_name, family_name, email, name]
+ responseType: JWT
+ userInfo:
+ responseType: JSON
+ userAttributes: [given_name, family_name, email]
diff --git a/tests/e2e/integrations/better-auth-nextjs-e2e/README.md b/tests/e2e/integrations/better-auth-nextjs-e2e/README.md
new file mode 100644
index 0000000..6820d14
--- /dev/null
+++ b/tests/e2e/integrations/better-auth-nextjs-e2e/README.md
@@ -0,0 +1,21 @@
+# ThunderID Better Auth Sample E2E
+
+Playwright suite for [`integrations/better-auth-nextjs`](../../../../integrations/better-auth-nextjs). It starts the sample from its own sources with its published SDK, signs in against a real ThunderID server, and checks:
+
+- Sign-in with ThunderID through Better Auth's generic OAuth plugin and the `thunderid()` helper
+- Better Auth holds a session for the ThunderID user
+- Sign-out ends the Better Auth session and the ThunderID session
+
+## Run
+
+Start a ThunderID server first (see the [E2E README](../../README.md)), then, from `tests/e2e`:
+
+```bash
+npm ci
+npx playwright install chromium
+npm test -w integrations/better-auth-nextjs-e2e
+```
+
+Playwright installs the sample with `npm ci` when it has no `node_modules`, and serves it on port 3003 with the OAuth2 client `SAMPLES_E2E_BETTER_AUTH_NEXTJS`. The global setup imports that client and creates the test users. Set `SAMPLES_ROOT` to run against another samples checkout, such as a `git archive` export.
+
+The sample registers no post-logout redirect URI, so after sign-out the browser stays on the ThunderID Gate; the spec opens the app again. Better Auth sends the client secret in the request body, so the suite's client uses `client_secret_post`.
diff --git a/tests/e2e/integrations/better-auth-nextjs-e2e/fixtures.ts b/tests/e2e/integrations/better-auth-nextjs-e2e/fixtures.ts
new file mode 100644
index 0000000..e573a8e
--- /dev/null
+++ b/tests/e2e/integrations/better-auth-nextjs-e2e/fixtures.ts
@@ -0,0 +1,13 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {test as base} from '@playwright/test';
+import {BetterAuthPage} from './pages/better-auth.page.ts';
+
+export const test = base.extend<{betterAuthPage: BetterAuthPage}>({
+ betterAuthPage: async ({page}, use) => {
+ await use(new BetterAuthPage(page));
+ },
+});
+
+export {expect} from '@playwright/test';
diff --git a/tests/e2e/integrations/better-auth-nextjs-e2e/package.json b/tests/e2e/integrations/better-auth-nextjs-e2e/package.json
new file mode 100644
index 0000000..dc9ffe2
--- /dev/null
+++ b/tests/e2e/integrations/better-auth-nextjs-e2e/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@thunderid/better-auth-nextjs-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "E2E suite of integrations/better-auth-nextjs",
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+}
diff --git a/tests/e2e/integrations/better-auth-nextjs-e2e/pages/better-auth.page.ts b/tests/e2e/integrations/better-auth-nextjs-e2e/pages/better-auth.page.ts
new file mode 100644
index 0000000..c088dff
--- /dev/null
+++ b/tests/e2e/integrations/better-auth-nextjs-e2e/pages/better-auth.page.ts
@@ -0,0 +1,52 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * integrations/better-auth-nextjs Page Object. Better Auth runs the OAuth flow against ThunderID
+ * through its generic OAuth plugin and the `thunderid()` helper; the app shows the Better Auth
+ * session it gets back. See app/page.tsx and app/components/Nav.tsx in the sample.
+ */
+
+import {expect} from '@playwright/test';
+import {Timeouts} from '../../../shared/constants/timeouts.ts';
+import {GateLoginPage} from '../../../shared/pages/gate-login.page.ts';
+
+export class BetterAuthPage extends GateLoginPage {
+ async goto(url: string): Promise {
+ // Server-rendered: wait for hydration, or the first click is a no-op.
+ await this.page.goto(url, {waitUntil: 'networkidle'});
+ }
+
+ async verifyHomePageLoaded(): Promise {
+ await expect(this.page.getByRole('button', {name: 'Sign in with ThunderID'})).toBeVisible({
+ timeout: Timeouts.ELEMENT_VISIBILITY,
+ });
+ }
+
+ async clickSignInButton(): Promise {
+ await this.page.getByRole('button', {name: 'Sign in with ThunderID'}).click();
+ }
+
+ async verifyLoggedIn(): Promise {
+ await expect(this.page.getByText('Session active')).toBeVisible({timeout: Timeouts.REDIRECT});
+ }
+
+ /**
+ * Signs out of Better Auth, which also ends the ThunderID session (RP-initiated logout). The
+ * sample registers no post-logout redirect URI, so the browser stays on the ThunderID Gate
+ * afterwards; open the app again to see it signed out.
+ */
+ async logout(): Promise {
+ const signOut = this.page.waitForResponse((response) => response.url().endsWith('/api/auth/sign-out'));
+ await this.page.getByRole('button', {exact: true, name: 'Sign out'}).click();
+ await signOut;
+ await this.page.waitForURL(/\/gate\//, {timeout: Timeouts.REDIRECT});
+ await this.page.waitForLoadState('networkidle');
+ }
+
+ async verifyLoggedOut(): Promise {
+ await expect(this.page.getByRole('button', {name: 'Sign in with ThunderID'})).toBeVisible({
+ timeout: Timeouts.REDIRECT,
+ });
+ }
+}
diff --git a/tests/e2e/integrations/better-auth-nextjs-e2e/playwright.config.ts b/tests/e2e/integrations/better-auth-nextjs-e2e/playwright.config.ts
new file mode 100644
index 0000000..f6707da
--- /dev/null
+++ b/tests/e2e/integrations/better-auth-nextjs-e2e/playwright.config.ts
@@ -0,0 +1,27 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {randomBytes} from 'node:crypto';
+import {sharedClientVariable} from '../../shared/apps.ts';
+import {defineSampleConfig, sampleWebServer} from '../../shared/playwright.ts';
+
+const appUrl = 'http://localhost:3003';
+
+const config = defineSampleConfig({
+ app: 'BETTER_AUTH_NEXTJS',
+ webServer: sampleWebServer('BETTER_AUTH_NEXTJS', {
+ command: 'npm run dev -- -p 3003',
+ env: {
+ BETTER_AUTH_SECRET: randomBytes(32).toString('base64'),
+ // Better Auth derives its callback URL, /api/auth/callback/thunderid, from this.
+ BETTER_AUTH_URL: appUrl,
+ NODE_TLS_REJECT_UNAUTHORIZED: '0',
+ THUNDERID_CLIENT_ID: sharedClientVariable('BETTER_AUTH_NEXTJS_CLIENT_ID'),
+ THUNDERID_CLIENT_SECRET: sharedClientVariable('BETTER_AUTH_NEXTJS_CLIENT_SECRET'),
+ THUNDERID_ISSUER: process.env.SERVER_URL!,
+ },
+ url: appUrl,
+ }),
+});
+
+export default config;
diff --git a/tests/e2e/integrations/better-auth-nextjs-e2e/tests/sign-in-out.spec.ts b/tests/e2e/integrations/better-auth-nextjs-e2e/tests/sign-in-out.spec.ts
new file mode 100644
index 0000000..9d4c2fc
--- /dev/null
+++ b/tests/e2e/integrations/better-auth-nextjs-e2e/tests/sign-in-out.spec.ts
@@ -0,0 +1,45 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * integrations/better-auth-nextjs - sign in with ThunderID through Better Auth, check the session
+ * Better Auth keeps, and sign out. Signs in as the shared test user (shared/apps.ts).
+ */
+
+import {SampleApps, sampleAppUrl, testUser} from '../../../shared/apps.ts';
+import {expect, test} from '../fixtures.ts';
+
+const appUrl = sampleAppUrl(SampleApps.BETTER_AUTH_NEXTJS);
+
+test.describe('integrations/better-auth-nextjs - Sign in and Sign out', () => {
+ test.beforeEach(async ({betterAuthPage}) => {
+ const {password, username} = testUser();
+ await betterAuthPage.goto(appUrl);
+ await betterAuthPage.verifyHomePageLoaded();
+ await betterAuthPage.clickSignInButton();
+ await betterAuthPage.verifyLoginPageLoaded();
+ await betterAuthPage.login(username, password);
+ await betterAuthPage.verifyLoggedIn();
+ });
+
+ test('TC001: signs in and shows the ThunderID user', async ({page}) => {
+ await expect(page.getByText(`${testUser().username}@example.com`)).toBeVisible();
+ await expect(page.getByText('OAuth provider')).toBeVisible();
+ });
+
+ test('TC002: Better Auth holds a session for the ThunderID user', async ({page}) => {
+ const response = await page.request.get(`${appUrl}/api/auth/get-session`);
+ expect(response.status()).toBe(200);
+ const session = (await response.json()) as {session?: {expiresAt?: string}; user?: {email?: string}} | null;
+ expect(session?.user?.email).toBe(`${testUser().username}@example.com`);
+ expect(new Date(session!.session!.expiresAt!).getTime()).toBeGreaterThan(Date.now());
+ });
+
+ test('TC003: signs out and ends the Better Auth session', async ({betterAuthPage, page}) => {
+ await betterAuthPage.logout();
+ await betterAuthPage.goto(appUrl);
+ await betterAuthPage.verifyLoggedOut();
+ const response = await page.request.get(`${appUrl}/api/auth/get-session`);
+ expect(await response.json()).toBeNull();
+ });
+});
diff --git a/tests/e2e/management/admin-react-e2e/README.md b/tests/e2e/management/admin-react-e2e/README.md
new file mode 100644
index 0000000..450d706
--- /dev/null
+++ b/tests/e2e/management/admin-react-e2e/README.md
@@ -0,0 +1,20 @@
+# ThunderID Admin Sample E2E
+
+Playwright suite for [`management/admin-react`](../../../../management/admin-react). It starts the sample from its own sources with its published SDK, signs in against a real ThunderID server, and checks:
+
+- The server administrator (`ADMIN_USERNAME`) signs in and gets the management sections
+- The Users page lists and finds the test user, and opens their details
+- The Groups and Roles pages load from the management API
+- Sign-out
+
+## Run
+
+Start a ThunderID server first (see the [E2E README](../../README.md)), then, from `tests/e2e`:
+
+```bash
+npm ci
+npx playwright install chromium
+npm test -w management/admin-react-e2e
+```
+
+Playwright installs the sample with `npm ci` when it has no `node_modules`, and serves it on port 5176 with the OAuth2 client `SAMPLES_E2E_ADMIN_REACT`. The global setup imports that client and creates the test users. Set `SAMPLES_ROOT` to run against another samples checkout, such as a `git archive` export.
diff --git a/tests/e2e/management/admin-react-e2e/fixtures.ts b/tests/e2e/management/admin-react-e2e/fixtures.ts
new file mode 100644
index 0000000..06eb674
--- /dev/null
+++ b/tests/e2e/management/admin-react-e2e/fixtures.ts
@@ -0,0 +1,13 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {test as base} from '@playwright/test';
+import {AdminPage} from './pages/admin.page.ts';
+
+export const test = base.extend<{adminPage: AdminPage}>({
+ adminPage: async ({page}, use) => {
+ await use(new AdminPage(page));
+ },
+});
+
+export {expect} from '@playwright/test';
diff --git a/tests/e2e/management/admin-react-e2e/package.json b/tests/e2e/management/admin-react-e2e/package.json
new file mode 100644
index 0000000..c024b61
--- /dev/null
+++ b/tests/e2e/management/admin-react-e2e/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@thunderid/admin-react-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "E2E suite of management/admin-react",
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+}
diff --git a/tests/e2e/management/admin-react-e2e/pages/admin.page.ts b/tests/e2e/management/admin-react-e2e/pages/admin.page.ts
new file mode 100644
index 0000000..ea3a3f6
--- /dev/null
+++ b/tests/e2e/management/admin-react-e2e/pages/admin.page.ts
@@ -0,0 +1,38 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * management/admin-react Page Object. The nav carries the SDK's default `SignInButton` and
+ * `UserDropdown`; a signed-in administrator gets a sidebar of management sections, each page
+ * rendered by an SDK management component (`UserList` and the like).
+ */
+
+import {type Locator, expect} from '@playwright/test';
+import {Timeouts} from '../../../shared/constants/timeouts.ts';
+import {ThunderIDWebSamplePage} from '../../../shared/pages/thunderid-web-sample.page.ts';
+
+export class AdminPage extends ThunderIDWebSamplePage {
+ protected signInButton(): Locator {
+ return this.page.getByRole('button', {name: /^sign in$/i}).first();
+ }
+
+ async goto(url: string): Promise {
+ await this.page.goto(url, {waitUntil: 'load'});
+ }
+
+ /** The sidebar of management sections, shown only when signed in. */
+ sidebarLink(section: string): Locator {
+ return this.page.locator('.admin-nav').getByRole('link', {exact: true, name: section});
+ }
+
+ async verifySidebarLoaded(): Promise {
+ await expect(this.sidebarLink('Users')).toBeVisible({timeout: Timeouts.REDIRECT});
+ }
+
+ async openSection(section: string): Promise {
+ await this.sidebarLink(section).click();
+ await expect(this.page.getByRole('heading', {name: section}).first()).toBeVisible({
+ timeout: Timeouts.ELEMENT_VISIBILITY,
+ });
+ }
+}
diff --git a/tests/e2e/management/admin-react-e2e/playwright.config.ts b/tests/e2e/management/admin-react-e2e/playwright.config.ts
new file mode 100644
index 0000000..a472f27
--- /dev/null
+++ b/tests/e2e/management/admin-react-e2e/playwright.config.ts
@@ -0,0 +1,20 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {sharedClientVariable} from '../../shared/apps.ts';
+import {defineSampleConfig, sampleWebServer} from '../../shared/playwright.ts';
+
+const config = defineSampleConfig({
+ app: 'ADMIN_REACT',
+ webServer: sampleWebServer('ADMIN_REACT', {
+ command: 'npm run dev -- --port 5176 --strictPort',
+ env: {
+ VITE_THUNDERID_BASE_URL: process.env.SERVER_URL!,
+ VITE_THUNDERID_CLIENT_ID: sharedClientVariable('ADMIN_REACT_CLIENT_ID'),
+ // The management API answers only tokens issued for the System resource server.
+ VITE_THUNDERID_RESOURCE: `${process.env.SERVER_URL}/mcp`,
+ },
+ }),
+});
+
+export default config;
diff --git a/tests/e2e/management/admin-react-e2e/tests/admin.spec.ts b/tests/e2e/management/admin-react-e2e/tests/admin.spec.ts
new file mode 100644
index 0000000..9523fc1
--- /dev/null
+++ b/tests/e2e/management/admin-react-e2e/tests/admin.spec.ts
@@ -0,0 +1,71 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * management/admin-react - an administrator signs in and reads the server's users through the
+ * SDK's management components. Signs in as the server's administrator (ADMIN_USERNAME and
+ * ADMIN_PASSWORD), whose token carries the `system` permission the management API requires.
+ */
+
+import {SampleApps, sampleAppUrl, testUser} from '../../../shared/apps.ts';
+import {Timeouts} from '../../../shared/constants/timeouts.ts';
+import {expect, test} from '../fixtures.ts';
+
+const appUrl = sampleAppUrl(SampleApps.ADMIN_REACT);
+
+test.describe('management/admin-react - Administration', () => {
+ test.beforeEach(async ({adminPage}) => {
+ await adminPage.goto(appUrl);
+ await adminPage.verifyHomePageLoaded();
+ await adminPage.clickSignInButton();
+ await adminPage.verifyLoginPageLoaded();
+ await adminPage.login(process.env.ADMIN_USERNAME!, process.env.ADMIN_PASSWORD!);
+ await adminPage.verifyLoggedIn();
+ });
+
+ test('TC001: an administrator signs in and gets the management sections', async ({adminPage}) => {
+ await adminPage.verifySidebarLoaded();
+ for (const section of ['Users', 'Groups', 'Roles', 'Applications', 'Organization units']) {
+ await expect(adminPage.sidebarLink(section)).toBeVisible();
+ }
+ });
+
+ test('TC002: the Users page lists and finds the test user', async ({adminPage, page}) => {
+ const {username} = testUser();
+ await adminPage.openSection('Users');
+
+ const search = page
+ .getByRole('searchbox')
+ .or(page.getByPlaceholder(/search/i))
+ .first();
+ await search.fill(username);
+ await expect(page.getByText(username, {exact: true}).first()).toBeVisible({timeout: Timeouts.ELEMENT_VISIBILITY});
+ });
+
+ test('TC003: opening a user shows their details', async ({adminPage, page}) => {
+ const {username} = testUser();
+ await adminPage.openSection('Users');
+ await page
+ .getByRole('searchbox')
+ .or(page.getByPlaceholder(/search/i))
+ .first()
+ .fill(username);
+ await page.getByText(username, {exact: true}).first().click();
+
+ await expect(page).toHaveURL(/\/users\/[^/]+$/, {timeout: Timeouts.ELEMENT_VISIBILITY});
+ await expect(page.getByText(username).first()).toBeVisible({timeout: Timeouts.ELEMENT_VISIBILITY});
+ });
+
+ test('TC004: the Groups and Roles pages load from the management API', async ({adminPage, page}) => {
+ for (const section of ['Groups', 'Roles']) {
+ await adminPage.openSection(section);
+ // An SDK list shows an alert when the management API turns the request down.
+ await expect(page.getByRole('alert')).toHaveCount(0);
+ }
+ });
+
+ test('TC005: signs out after a successful sign-in', async ({adminPage}) => {
+ await adminPage.logout();
+ await adminPage.verifyLoggedOut();
+ });
+});
diff --git a/tests/e2e/package-lock.json b/tests/e2e/package-lock.json
new file mode 100644
index 0000000..77c56fa
--- /dev/null
+++ b/tests/e2e/package-lock.json
@@ -0,0 +1,316 @@
+{
+ "name": "@thunderid/samples-e2e",
+ "version": "0.0.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "@thunderid/samples-e2e",
+ "version": "0.0.0",
+ "workspaces": [
+ "shared",
+ "*/*-e2e"
+ ],
+ "devDependencies": {
+ "@thunderid/prettier-config": "latest",
+ "@types/node": "24.7.2",
+ "prettier": "3.6.2",
+ "typescript": "5.9.3"
+ }
+ },
+ "b2b/wayfinder-enterprise-nextjs-e2e": {
+ "name": "@thunderid/wayfinder-enterprise-nextjs-e2e",
+ "version": "0.0.0",
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+ },
+ "integrations/better-auth-nextjs-e2e": {
+ "name": "@thunderid/better-auth-nextjs-e2e",
+ "version": "0.0.0",
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+ },
+ "management/admin-react-e2e": {
+ "name": "@thunderid/admin-react-e2e",
+ "version": "0.0.0",
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+ },
+ "node_modules/@playwright/test": {
+ "version": "1.64.1",
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.64.1.tgz",
+ "integrity": "sha512-IaYGml/nSOiZWROfPtuIL7neuu9qDOZ3TNvNljUIrhDMxiGTgPjzj/g9p9RxpS2tSepPDRY+UwAaEeiKtUvIAg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "playwright": "1.64.1"
+ },
+ "bin": {
+ "playwright": "cli.js"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@thunderid/admin-react-e2e": {
+ "resolved": "management/admin-react-e2e",
+ "link": true
+ },
+ "node_modules/@thunderid/better-auth-nextjs-e2e": {
+ "resolved": "integrations/better-auth-nextjs-e2e",
+ "link": true
+ },
+ "node_modules/@thunderid/bff-react-express-e2e": {
+ "resolved": "patterns/bff-react-express-e2e",
+ "link": true
+ },
+ "node_modules/@thunderid/myaccount-react-e2e": {
+ "resolved": "self-service/myaccount-react-e2e",
+ "link": true
+ },
+ "node_modules/@thunderid/prettier-config": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@thunderid/prettier-config/-/prettier-config-1.0.1.tgz",
+ "integrity": "sha512-f92R2erhp6d6e2DrMAsDIwdYpytdQP0bPHGq5ium/EN6L/JIHyn/O75tMqJUAuyumdfmF8eonA1dnxIqYSwPgQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "tslib": "2.8.1"
+ }
+ },
+ "node_modules/@thunderid/quickstart-browser-e2e": {
+ "resolved": "quickstarts/quickstart-browser-e2e",
+ "link": true
+ },
+ "node_modules/@thunderid/quickstart-express-e2e": {
+ "resolved": "quickstarts/quickstart-express-e2e",
+ "link": true
+ },
+ "node_modules/@thunderid/quickstart-nextjs-b2b-e2e": {
+ "resolved": "quickstarts/quickstart-nextjs-b2b-e2e",
+ "link": true
+ },
+ "node_modules/@thunderid/quickstart-nextjs-e2e": {
+ "resolved": "quickstarts/quickstart-nextjs-e2e",
+ "link": true
+ },
+ "node_modules/@thunderid/quickstart-node-e2e": {
+ "resolved": "quickstarts/quickstart-node-e2e",
+ "link": true
+ },
+ "node_modules/@thunderid/quickstart-nuxt-e2e": {
+ "resolved": "quickstarts/quickstart-nuxt-e2e",
+ "link": true
+ },
+ "node_modules/@thunderid/quickstart-react-b2b-e2e": {
+ "resolved": "quickstarts/quickstart-react-b2b-e2e",
+ "link": true
+ },
+ "node_modules/@thunderid/quickstart-react-e2e": {
+ "resolved": "quickstarts/quickstart-react-e2e",
+ "link": true
+ },
+ "node_modules/@thunderid/quickstart-vue-e2e": {
+ "resolved": "quickstarts/quickstart-vue-e2e",
+ "link": true
+ },
+ "node_modules/@thunderid/samples-e2e-shared": {
+ "resolved": "shared",
+ "link": true
+ },
+ "node_modules/@thunderid/wayfinder-enterprise-nextjs-e2e": {
+ "resolved": "b2b/wayfinder-enterprise-nextjs-e2e",
+ "link": true
+ },
+ "node_modules/@types/node": {
+ "version": "24.7.2",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.7.2.tgz",
+ "integrity": "sha512-/NbVmcGTP+lj5oa4yiYxxeBjRivKQ5Ns1eSZeB99ExsEQ6rX5XYU1Zy/gGxY/ilqtD4Etx9mKyrPxZRetiahhA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~7.14.0"
+ }
+ },
+ "node_modules/dotenv": {
+ "version": "17.2.3",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.3.tgz",
+ "integrity": "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w==",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://dotenvx.com"
+ }
+ },
+ "node_modules/playwright": {
+ "version": "1.64.1",
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.64.1.tgz",
+ "integrity": "sha512-HCrVhHr5QQuwYoswEUGTb7gGp522yflbv/ST8nF4sFWGuLjQCt17Q/EubpGGSNKYn1tsTCPZxqHhHCfVURu7UA==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "playwright-core": "1.64.1"
+ },
+ "bin": {
+ "playwright": "cli.js"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/playwright-core": {
+ "version": "1.64.1",
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.64.1.tgz",
+ "integrity": "sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ==",
+ "license": "Apache-2.0",
+ "bin": {
+ "playwright-core": "cli.js"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/prettier": {
+ "version": "3.6.2",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz",
+ "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "prettier": "bin/prettier.cjs"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/prettier/prettier?sponsor=1"
+ }
+ },
+ "node_modules/tslib": {
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
+ "dev": true,
+ "license": "0BSD"
+ },
+ "node_modules/typescript": {
+ "version": "5.9.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
+ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
+ "node_modules/undici": {
+ "version": "7.30.1",
+ "resolved": "https://registry.npmjs.org/undici/-/undici-7.30.1.tgz",
+ "integrity": "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=20.18.1"
+ }
+ },
+ "node_modules/undici-types": {
+ "version": "7.14.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.14.0.tgz",
+ "integrity": "sha512-QQiYxHuyZ9gQUIrmPo3IA+hUl4KYk8uSA7cHrcKd/l3p1OTpZcM0Tbp9x7FAtXdAYhlasd60ncPpgu6ihG6TOA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "patterns/bff-react-express-e2e": {
+ "name": "@thunderid/bff-react-express-e2e",
+ "version": "0.0.0",
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+ },
+ "quickstarts/quickstart-browser-e2e": {
+ "name": "@thunderid/quickstart-browser-e2e",
+ "version": "0.0.0",
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+ },
+ "quickstarts/quickstart-express-e2e": {
+ "name": "@thunderid/quickstart-express-e2e",
+ "version": "0.0.0",
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+ },
+ "quickstarts/quickstart-nextjs-b2b-e2e": {
+ "name": "@thunderid/quickstart-nextjs-b2b-e2e",
+ "version": "0.0.0",
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+ },
+ "quickstarts/quickstart-nextjs-e2e": {
+ "name": "@thunderid/quickstart-nextjs-e2e",
+ "version": "0.0.0",
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+ },
+ "quickstarts/quickstart-node-e2e": {
+ "name": "@thunderid/quickstart-node-e2e",
+ "version": "0.0.0",
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+ },
+ "quickstarts/quickstart-nuxt-e2e": {
+ "name": "@thunderid/quickstart-nuxt-e2e",
+ "version": "0.0.0",
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+ },
+ "quickstarts/quickstart-react-b2b-e2e": {
+ "name": "@thunderid/quickstart-react-b2b-e2e",
+ "version": "0.0.0",
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+ },
+ "quickstarts/quickstart-react-e2e": {
+ "name": "@thunderid/quickstart-react-e2e",
+ "version": "0.0.0",
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+ },
+ "quickstarts/quickstart-vue-e2e": {
+ "name": "@thunderid/quickstart-vue-e2e",
+ "version": "0.0.0",
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+ },
+ "self-service/myaccount-react-e2e": {
+ "name": "@thunderid/myaccount-react-e2e",
+ "version": "0.0.0",
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+ },
+ "shared": {
+ "name": "@thunderid/samples-e2e-shared",
+ "version": "0.0.0",
+ "dependencies": {
+ "@playwright/test": "1.64.1",
+ "dotenv": "17.2.3",
+ "undici": "7.30.1"
+ }
+ }
+ }
+}
diff --git a/tests/e2e/package.json b/tests/e2e/package.json
new file mode 100644
index 0000000..7955cbf
--- /dev/null
+++ b/tests/e2e/package.json
@@ -0,0 +1,23 @@
+{
+ "name": "@thunderid/samples-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "End-to-end tests for the ThunderID sample apps, one suite per app",
+ "type": "module",
+ "workspaces": [
+ "shared",
+ "*/*-e2e"
+ ],
+ "scripts": {
+ "test": "npm run test --workspaces --if-present",
+ "format:check": "prettier --check --cache .",
+ "format:fix": "prettier --write --cache .",
+ "type-check": "tsc --noEmit"
+ },
+ "devDependencies": {
+ "@thunderid/prettier-config": "latest",
+ "@types/node": "24.7.2",
+ "prettier": "3.6.2",
+ "typescript": "5.9.3"
+ }
+}
diff --git a/tests/e2e/patterns/bff-react-express-e2e/README.md b/tests/e2e/patterns/bff-react-express-e2e/README.md
new file mode 100644
index 0000000..bfc7429
--- /dev/null
+++ b/tests/e2e/patterns/bff-react-express-e2e/README.md
@@ -0,0 +1,22 @@
+# ThunderID React and Express BFF Sample E2E
+
+Playwright suite for [`patterns/bff-react-express`](../../../../patterns/bff-react-express). It starts the sample from its own sources with its published SDK, signs in against a real ThunderID server, and checks:
+
+- Sign-in through the BFF, which reports the session at `/api/auth/session` and keeps the session cookie `HttpOnly`
+- An API call through `/api/auth/proxy` carries the access token
+- The Token debug page shows the access token the BFF exposes
+- Sign-out ends the BFF session, and the BFF refuses requests without `X-Requested-With` or a session
+
+## Run
+
+Start a ThunderID server first (see the [E2E README](../../README.md)), then, from `tests/e2e`:
+
+```bash
+npm ci
+npx playwright install chromium
+npm test -w patterns/bff-react-express-e2e
+```
+
+Playwright installs the sample with `npm ci` when it has no `node_modules`, and serves it on port 5178 with the OAuth2 client `SAMPLES_E2E_BFF_REACT_EXPRESS`. The global setup imports that client and creates the test users. Set `SAMPLES_ROOT` to run against another samples checkout, such as a `git archive` export.
+
+The suite starts two servers: the BFF on port 3004 (`npm start -w server`) and the React app on 5178 (`npm run dev -w client`), which forwards `/api/auth` to the BFF.
diff --git a/tests/e2e/patterns/bff-react-express-e2e/fixtures.ts b/tests/e2e/patterns/bff-react-express-e2e/fixtures.ts
new file mode 100644
index 0000000..40b3ca0
--- /dev/null
+++ b/tests/e2e/patterns/bff-react-express-e2e/fixtures.ts
@@ -0,0 +1,15 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {test as base} from '@playwright/test';
+import {ThunderIDAccountPageSamplePage} from '../../shared/pages/thunderid-web-sample.page.ts';
+
+// The React app renders the same nav, dropdown and token debug page as the React quickstart, so
+// the shared page object drives it.
+export const test = base.extend<{bffPage: ThunderIDAccountPageSamplePage}>({
+ bffPage: async ({page}, use) => {
+ await use(new ThunderIDAccountPageSamplePage(page));
+ },
+});
+
+export {expect} from '@playwright/test';
diff --git a/tests/e2e/patterns/bff-react-express-e2e/package.json b/tests/e2e/patterns/bff-react-express-e2e/package.json
new file mode 100644
index 0000000..c1c6fd0
--- /dev/null
+++ b/tests/e2e/patterns/bff-react-express-e2e/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@thunderid/bff-react-express-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "E2E suite of patterns/bff-react-express",
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+}
diff --git a/tests/e2e/patterns/bff-react-express-e2e/playwright.config.ts b/tests/e2e/patterns/bff-react-express-e2e/playwright.config.ts
new file mode 100644
index 0000000..9c4a12d
--- /dev/null
+++ b/tests/e2e/patterns/bff-react-express-e2e/playwright.config.ts
@@ -0,0 +1,36 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {sharedClientVariable} from '../../shared/apps.ts';
+import {defineSampleConfig, sampleWebServer} from '../../shared/playwright.ts';
+
+// The BFF signs users in and holds the tokens; the React app reaches it on its own origin under
+// /api/auth through the Vite dev server's proxy, so the BFF's session cookie is first party.
+const appUrl = 'http://localhost:5178';
+const bffPort = 3004;
+
+const config = defineSampleConfig({
+ app: 'BFF_REACT_EXPRESS',
+ webServer: [
+ sampleWebServer('BFF_REACT_EXPRESS', {
+ command: 'npm start -w server',
+ env: {
+ APP_URL: appUrl,
+ NODE_TLS_REJECT_UNAUTHORIZED: '0',
+ PORT: String(bffPort),
+ THUNDERID_BASE_URL: process.env.SERVER_URL!,
+ THUNDERID_CLIENT_ID: sharedClientVariable('BFF_REACT_EXPRESS_CLIENT_ID'),
+ THUNDERID_CLIENT_SECRET: sharedClientVariable('BFF_REACT_EXPRESS_CLIENT_SECRET'),
+ },
+ port: bffPort,
+ }),
+ sampleWebServer('BFF_REACT_EXPRESS', {
+ command: 'npm run dev -w client -- --port 5178 --strictPort',
+ env: {BFF_URL: `http://localhost:${bffPort}`},
+ skipInstall: true,
+ url: appUrl,
+ }),
+ ],
+});
+
+export default config;
diff --git a/tests/e2e/patterns/bff-react-express-e2e/tests/bff.spec.ts b/tests/e2e/patterns/bff-react-express-e2e/tests/bff.spec.ts
new file mode 100644
index 0000000..e8c67d4
--- /dev/null
+++ b/tests/e2e/patterns/bff-react-express-e2e/tests/bff.spec.ts
@@ -0,0 +1,87 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * patterns/bff-react-express - sign-in through the Express BFF, which keeps the tokens on the
+ * server behind an HttpOnly session cookie. Checks the session the BFF reports, an API call
+ * through its proxy, the access token it exposes for the Token debug page, and sign-out.
+ *
+ * The BFF answers browser SDK calls only with `X-Requested-With: XMLHttpRequest`, so the direct
+ * requests below send it, and share the page's cookies through `page.request`.
+ */
+
+import type {APIRequestContext} from '@playwright/test';
+import {SampleApps, sampleAppUrl, testUser} from '../../../shared/apps.ts';
+import {decodeJwtPayload} from '../../../shared/utils/jwt/index.ts';
+import {expect, test} from '../fixtures.ts';
+
+const appUrl = sampleAppUrl(SampleApps.BFF_REACT_EXPRESS);
+const XHR = {'X-Requested-With': 'XMLHttpRequest'};
+
+function getSession(request: APIRequestContext) {
+ return request.get(`${appUrl}/api/auth/session`, {headers: XHR});
+}
+
+test.describe('patterns/bff-react-express - BFF session', () => {
+ test.beforeEach(async ({bffPage}) => {
+ const {password, username} = testUser();
+ await bffPage.goto(appUrl);
+ await bffPage.verifyHomePageLoaded();
+ await bffPage.clickSignInButton();
+ await bffPage.verifyLoginPageLoaded();
+ await bffPage.login(username, password);
+ await bffPage.verifyLoggedIn();
+ });
+
+ test('TC001: the BFF reports the signed-in session, without handing the browser a token', async ({page}) => {
+ const response = await getSession(page.request);
+ expect(response.status()).toBe(200);
+ const session = (await response.json()) as {isSignedIn: boolean; user?: Record};
+ expect(session.isSignedIn).toBe(true);
+ expect(session.user?.sub).toBeTruthy();
+
+ // The session cookie is HttpOnly, so page scripts cannot read it.
+ const cookies = await page.context().cookies(appUrl);
+ const sessionCookie = cookies.find((cookie) => cookie.name === 'thunderid-session');
+ expect(sessionCookie?.httpOnly).toBe(true);
+ expect(await page.evaluate(() => document.cookie)).not.toContain('thunderid-session');
+ });
+
+ test('TC002: an API call through /api/auth/proxy carries the access token', async ({page}) => {
+ const response = await page.request.get(`${appUrl}/api/auth/proxy/users/me`, {headers: XHR});
+ expect(response.status()).toBe(200);
+ const me = (await response.json()) as {attributes?: Record};
+ expect(me.attributes?.username).toBe(testUser().username);
+ });
+
+ test('TC003: the Token debug page shows the access token the BFF exposes', async ({bffPage}) => {
+ await bffPage.openTokenDebug();
+ await bffPage.verifyTokenDebugLoaded();
+ const payload = decodeJwtPayload(await bffPage.getDisplayedAccessToken());
+ expect(payload.sub).toBeTruthy();
+ expect(payload.exp as number).toBeGreaterThan(Math.floor(Date.now() / 1000));
+ });
+
+ test('TC004: signing out ends the BFF session', async ({bffPage, page}) => {
+ await bffPage.logout();
+ await bffPage.verifyLoggedOut();
+
+ const session = (await (await getSession(page.request)).json()) as {isSignedIn: boolean};
+ expect(session.isSignedIn).toBe(false);
+ const proxied = await page.request.get(`${appUrl}/api/auth/proxy/users/me`, {headers: XHR});
+ expect(proxied.status()).toBe(401);
+ });
+});
+
+test.describe('patterns/bff-react-express - BFF request checks', () => {
+ test('TC005: refuses a browser SDK endpoint without X-Requested-With', async ({request}) => {
+ const response = await request.get(`${appUrl}/api/auth/session`);
+ expect(response.status()).toBeGreaterThanOrEqual(400);
+ expect(response.status()).toBeLessThan(500);
+ });
+
+ test('TC006: the proxy answers 401 without a session', async ({request}) => {
+ const response = await request.get(`${appUrl}/api/auth/proxy/users/me`, {headers: XHR});
+ expect(response.status()).toBe(401);
+ });
+});
diff --git a/tests/e2e/prettier.config.js b/tests/e2e/prettier.config.js
new file mode 100644
index 0000000..75d864b
--- /dev/null
+++ b/tests/e2e/prettier.config.js
@@ -0,0 +1,10 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import config from '@thunderid/prettier-config';
+
+export default {
+ ...config,
+ // Markdown paragraphs stay on one line each, so a small edit does not reflow the whole paragraph.
+ overrides: [...(config.overrides ?? []), {files: '*.md', options: {proseWrap: 'preserve'}}],
+};
diff --git a/tests/e2e/quickstarts/quickstart-android-e2e/README.md b/tests/e2e/quickstarts/quickstart-android-e2e/README.md
new file mode 100644
index 0000000..42ac636
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-android-e2e/README.md
@@ -0,0 +1,44 @@
+# ThunderID Android Quickstart E2E
+
+Maestro flows that drive [`quickstarts/quickstart-android`](../../../../quickstarts/quickstart-android) through real authentication against a real ThunderID server on a running Android emulator. The sample is built from this repository with the SDK release it pins.
+
+| Flow | What it checks |
+| ------------------------------ | ----------------------------------------------------------------- |
+| `flows/signin.yaml` | Sign in through the server-driven credentials step, then sign out |
+| `flows/signup.yaml` | Register a new user, then sign in as them |
+| `flows/change-credential.yaml` | Change the password from Manage Account, then change it back |
+
+`flows/subflows/` holds the building blocks the flows share. The flows are the ones the SDK repository's suite ran, unchanged: each platform's UI differs enough (system dialogs, field ids, scrolling) that the three mobile suites keep their own flows.
+
+## Prerequisites
+
+the Android SDK with `adb` and a running emulator, a JDK 17, [Maestro](https://maestro.mobile.dev/getting-started/installing-maestro), `curl`, `jq`, `openssl`, `unzip`.
+
+## Run
+
+```bash
+# Everything: start or reuse a server, provision it, build and install the sample, run the flows
+./run-e2e.sh
+
+# Iterate faster once the server is provisioned and the sample installed
+./run-e2e.sh --skip-server --skip-build
+
+# One flow
+./run-e2e.sh flows/signin.yaml
+```
+
+`run-e2e.sh` uses [`shared/scripts/thunderid.sh`](../../shared/scripts/thunderid.sh) to start the server (or reuse one already serving on `SERVER_URL`), imports the sample's own `thunderid-config/thunderid-config.yaml`, creates the test user `e2e_mobile_user` / `TestPassword@123`, then writes `config.properties` into the sample (pointing at `10.0.2.2`, the emulator's alias for the host), and installs it with `./gradlew installDebug`. Maestro writes a JUnit report to `report.xml`. Set `SAMPLES_ROOT` to build the sample from another samples checkout. The script writes the sample's local config file (git-ignored in the sample), so point `SAMPLES_ROOT` at a copy if you keep your own config there.
+
+Windows: the SDK repository's `run-e2e.ps1` is not ported; run the suite from macOS or Linux.
+
+These suites do not run in CI yet. Adding them, on macOS runners with a simulator and on Linux with an Android emulator, is a follow-up.
+
+## Things worth knowing
+
+**The application must be `type: mobile` with `attestation.devMode: true`.** A mobile application normally proves its binary identity through platform attestation before it can start a flow directly, and `/flow/execute` rejects it with `FES-1016` otherwise. Neither Apple App Attest nor Play Integrity works on an emulated device. `devMode` is test-only and must never be enabled on a real tenant.
+
+**`POST /import` drops the `attestation` block.** It reports success and stores `attestation: null`, so `run-e2e.sh` re-applies it over `PUT /applications/{id}`. Once the import keeps it, that step can go.
+
+**Sign-up does not sign the user in.** The registration flow completes without an assertion, so `signup.yaml` signs in afterwards with the new credentials, which also proves the account works. Each run leaves an `e2e_signup_` user on the server.
+
+**`change-credential.yaml` really changes the test user's password**, to a temporary value and back. If a run fails in between, re-running `change-credential.yaml` changes it back.
diff --git a/tests/e2e/quickstarts/quickstart-android-e2e/flows/change-credential.yaml b/tests/e2e/quickstarts/quickstart-android-e2e/flows/change-credential.yaml
new file mode 100644
index 0000000..e3eebc7
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-android-e2e/flows/change-credential.yaml
@@ -0,0 +1,89 @@
+appId: dev.thunderid.Quickstart
+name: Change password from Manage Account
+tags:
+ - account
+env:
+ E2E_USERNAME: e2e_mobile_user
+ E2E_PASSWORD: TestPassword@123
+ # This flow actually changes E2E_PASSWORD on the shared E2E user via the real backend (the
+ # self-service credential write path has no "current value" concept to gate this behind), so it
+ # changes to this value and back to E2E_PASSWORD before finishing. If this flow fails between
+ # those two steps, the E2E user is left on this password until the next run fixes it, not
+ # E2E_PASSWORD - see the closing comment for how a re-run recovers on its own.
+ E2E_TEMP_PASSWORD: TempPassword@456
+---
+- launchApp:
+ clearState: true
+- runFlow: subflows/ensure-signed-out.yaml
+
+- tapOn: 'Sign in'
+
+# The credentials step is rendered from the flow definition the server returns, not from static
+# native views. The SDK tags each input with the field's identifier and each button with the
+# action's ref, so these ids track the server's flow response.
+#
+# Compose keeps testTag inside its own semantics tree, so these ids are only visible to Maestro
+# because the SDK opts the subtree in via testTagsAsResourceId.
+- extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 25000
+
+- tapOn:
+ id: 'thunderid-field-username'
+- inputText: ${E2E_USERNAME}
+
+- tapOn:
+ id: 'thunderid-field-password'
+- inputText: ${E2E_PASSWORD}
+
+- tapOn:
+ id: 'thunderid-action-action_001'
+
+- extendedWaitUntil:
+ visible: 'Session active'
+ timeout: 30000
+
+# See signin.yaml's equivalent comment: the home screen's own recomposition (a live "expires in"
+# countdown) can reset the scroll position in the gap between scrollUntilVisible finding an
+# element and the tap landing, so this is wrapped in a retry.
+- retry:
+ maxRetries: 2
+ commands:
+ - scrollUntilVisible:
+ element: 'Manage Account'
+ direction: DOWN
+ timeout: 20000
+ - waitForAnimationToEnd:
+ timeout: 3000
+ - tapOn: 'Manage Account'
+
+- extendedWaitUntil:
+ visible: 'Change Password'
+ timeout: 20000
+
+# Change away from E2E_PASSWORD, then immediately back, so the E2E user's credential is unchanged
+# once this flow finishes, matching signin.yaml's "leaves the app as it found it" convention.
+- runFlow:
+ file: subflows/change-password-to.yaml
+ env:
+ NEW_PASSWORD: ${E2E_TEMP_PASSWORD}
+- runFlow:
+ file: subflows/change-password-to.yaml
+ env:
+ NEW_PASSWORD: ${E2E_PASSWORD}
+
+- tapOn: 'Home'
+- retry:
+ maxRetries: 2
+ commands:
+ - scrollUntilVisible:
+ element: 'Sign out'
+ direction: DOWN
+ timeout: 20000
+ - waitForAnimationToEnd:
+ timeout: 3000
+ - tapOn: 'Sign out'
+- extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 20000
diff --git a/tests/e2e/quickstarts/quickstart-android-e2e/flows/config.yaml b/tests/e2e/quickstarts/quickstart-android-e2e/flows/config.yaml
new file mode 100644
index 0000000..f31a6e5
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-android-e2e/flows/config.yaml
@@ -0,0 +1,6 @@
+# Maestro workspace configuration for the Android Quickstart E2E suite.
+#
+# Only the top-level flows are test entry points. Without this, `maestro test .maestro/` would
+# also recurse into subflows/ and run the shared building blocks as if they were tests.
+flows:
+ - '*.yaml'
diff --git a/tests/e2e/quickstarts/quickstart-android-e2e/flows/signin.yaml b/tests/e2e/quickstarts/quickstart-android-e2e/flows/signin.yaml
new file mode 100644
index 0000000..75591ec
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-android-e2e/flows/signin.yaml
@@ -0,0 +1,67 @@
+appId: dev.thunderid.Quickstart
+name: Sign in and sign out
+tags:
+ - auth
+env:
+ E2E_USERNAME: e2e_mobile_user
+ E2E_PASSWORD: TestPassword@123
+---
+- launchApp:
+ clearState: true
+- runFlow: subflows/ensure-signed-out.yaml
+
+- tapOn: 'Sign in'
+
+# The credentials step is rendered from the flow definition the server returns, not from static
+# native views. The SDK tags each input with the field's identifier and each button with the
+# action's ref, so these ids track the server's flow response.
+#
+# Compose keeps testTag inside its own semantics tree, so these ids are only visible to Maestro
+# because the SDK opts the subtree in via testTagsAsResourceId.
+- extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 25000
+
+- tapOn:
+ id: 'thunderid-field-username'
+- inputText: ${E2E_USERNAME}
+
+- tapOn:
+ id: 'thunderid-field-password'
+- inputText: ${E2E_PASSWORD}
+
+- tapOn:
+ id: 'thunderid-action-action_001'
+
+# Authenticated state.
+- extendedWaitUntil:
+ visible: 'Session active'
+ timeout: 30000
+
+# ...and back out again, so the flow leaves the app as it found it.
+#
+# The scroll-then-tap is wrapped in a retry: a debug screenshot from a failed tapOn on the
+# equivalent step in signup.yaml showed the list back at the very top, scrolled up again after
+# scrollUntilVisible had already found "Sign out" - the home screen's own recomposition (it has a
+# live "expires in" countdown) reset the scroll position in the gap before the tap landed.
+# Retrying re-does the scroll from wherever the list actually is.
+- retry:
+ maxRetries: 2
+ commands:
+ - scrollUntilVisible:
+ element: 'Sign out'
+ direction: DOWN
+ timeout: 20000
+
+ # "Token debug" sits immediately above "Sign out" in the action list. Tapping right as the
+ # scroll lands has, at least once, hit "Token debug" instead of "Sign out" - the scroll's
+ # own settle animation was still resolving when the tap coordinate was computed. Let it
+ # finish first.
+ - waitForAnimationToEnd:
+ timeout: 3000
+ - tapOn: 'Sign out'
+
+- extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 20000
diff --git a/tests/e2e/quickstarts/quickstart-android-e2e/flows/signup.yaml b/tests/e2e/quickstarts/quickstart-android-e2e/flows/signup.yaml
new file mode 100644
index 0000000..9660de7
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-android-e2e/flows/signup.yaml
@@ -0,0 +1,107 @@
+appId: dev.thunderid.Quickstart
+name: Sign up a new user, then sign in as them
+tags:
+ - auth
+env:
+ E2E_PASSWORD: TestPassword@123
+---
+- launchApp:
+ clearState: true
+- runFlow: subflows/ensure-signed-out.yaml
+
+# Registration has to claim a username that does not exist yet, so each run generates its own.
+# This leaves a user behind on the target server per run, which is fine for a disposable CI
+# instance; against a long-lived dev server, expect the accounts to accumulate.
+- evalScript: ${output.username = 'e2e_signup_' + Date.now()}
+
+- tapOn: 'Get started'
+
+# The registration step is server-rendered like the sign-in step, but its flow definition uses
+# different action refs, so the submit button id differs from signin.yaml.
+- extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 25000
+
+- tapOn:
+ id: 'thunderid-field-username'
+- inputText: ${output.username}
+
+- tapOn:
+ id: 'thunderid-field-password'
+- inputText: ${E2E_PASSWORD}
+
+- tapOn:
+ id: 'thunderid-action-action_credentials'
+
+# Registration is multi-step: the credentials step is followed by a step collecting the
+# attributes the user schema requires (email here). Each step is a fresh server-rendered view
+# with its own action ref.
+- extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-email'
+ timeout: 25000
+
+- tapOn:
+ id: 'thunderid-field-email'
+- inputText: ${output.username}@example.com
+
+- tapOn:
+ id: 'thunderid-action-action_schema_attrs'
+
+# Registration completes without issuing an assertion, so the user is created but NOT signed in
+# and the app falls back to the landing screen. Signing in with the credentials just registered
+# is what proves the account is actually usable.
+- extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 30000
+
+- tapOn: 'Sign in'
+- extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 25000
+
+- tapOn:
+ id: 'thunderid-field-username'
+- inputText: ${output.username}
+
+- tapOn:
+ id: 'thunderid-field-password'
+- inputText: ${E2E_PASSWORD}
+
+- tapOn:
+ id: 'thunderid-action-action_001'
+
+- extendedWaitUntil:
+ visible: 'Session active'
+ timeout: 30000
+
+# By this point the flow has already registered a new account and signed back in with it, so a
+# loaded CI runner has more accumulated latency behind it here than at the equivalent step in
+# signin.yaml - give the scroll a 30s budget rather than the 20s that step uses.
+#
+# The scroll-then-tap is wrapped in a retry: a debug screenshot from a failed tapOn here showed
+# the list back at the very top, scrolled up again after scrollUntilVisible had already found
+# "Sign out" - the home screen's own recomposition (it has a live "expires in" countdown) reset
+# the scroll position in the gap before the tap landed. Retrying re-does the scroll from wherever
+# the list actually is rather than assuming the first scroll's result still holds.
+- retry:
+ maxRetries: 2
+ commands:
+ - scrollUntilVisible:
+ element: 'Sign out'
+ direction: DOWN
+ timeout: 30000
+
+ # "Token debug" sits immediately above "Sign out" in the action list. Tapping right as the
+ # scroll lands has, at least once, hit "Token debug" instead of "Sign out" - the scroll's
+ # own settle animation was still resolving when the tap coordinate was computed. Let it
+ # finish first.
+ - waitForAnimationToEnd:
+ timeout: 3000
+ - tapOn: 'Sign out'
+
+- extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 20000
diff --git a/tests/e2e/quickstarts/quickstart-android-e2e/flows/subflows/change-password-to.yaml b/tests/e2e/quickstarts/quickstart-android-e2e/flows/subflows/change-password-to.yaml
new file mode 100644
index 0000000..3217574
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-android-e2e/flows/subflows/change-password-to.yaml
@@ -0,0 +1,32 @@
+appId: dev.thunderid.Quickstart
+---
+# Opens the ChangeCredential dialog from the Manage Account screen's "Change Password" row,
+# submits NEW_PASSWORD as both the new value and its confirmation, and waits for the dialog to
+# auto-dismiss (ChangeCredential's own success behavior - there is no separate on-screen
+# confirmation).
+#
+# The submit button is targeted by id, not by its visible text: the button's label
+# ("Change Password", from changeCredential.submit) is identical to the dialog's own header text
+# (changeCredential.heading), so tapOn by text would be ambiguous between the two.
+- tapOn: 'Change Password'
+- extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-newCredential'
+ timeout: 20000
+- waitForAnimationToEnd:
+ timeout: 3000
+
+- tapOn:
+ id: 'thunderid-field-newCredential'
+- inputText: ${NEW_PASSWORD}
+- tapOn:
+ id: 'thunderid-field-confirmCredential'
+- inputText: ${NEW_PASSWORD}
+
+- tapOn:
+ id: 'thunderid-action-submitCredential'
+
+# The dialog auto-dismisses on success, so the row's own heading becomes visible again.
+- extendedWaitUntil:
+ visible: 'Change Password'
+ timeout: 20000
diff --git a/tests/e2e/quickstarts/quickstart-android-e2e/flows/subflows/ensure-signed-out.yaml b/tests/e2e/quickstarts/quickstart-android-e2e/flows/subflows/ensure-signed-out.yaml
new file mode 100644
index 0000000..3f6c1a7
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-android-e2e/flows/subflows/ensure-signed-out.yaml
@@ -0,0 +1,80 @@
+appId: dev.thunderid.Quickstart
+---
+# Bring the app to the unauthenticated landing screen, whatever state it starts in.
+#
+# The SDK persists tokens in EncryptedSharedPreferences, which `clearState: true` does clear, but
+# the app can also be left mid-session by a previous flow that failed part way through. Starting
+# from an explicit known state keeps the suite re-runnable either way.
+- runFlow:
+ when:
+ visible: 'Session active'
+ commands:
+ # The scroll-then-tap is wrapped in a retry: a debug screenshot from a failed tapOn on the
+ # equivalent step in signup.yaml showed the list back at the very top, scrolled up again
+ # after scrollUntilVisible had already found "Sign out" - the home screen's own
+ # recomposition (it has a live "expires in" countdown) reset the scroll position in the gap
+ # before the tap landed. Retrying re-does the scroll from wherever the list actually is.
+ - retry:
+ maxRetries: 2
+ commands:
+ - scrollUntilVisible:
+ element: 'Sign out'
+ direction: DOWN
+ timeout: 20000
+ # "Token debug" sits immediately above "Sign out" in the action list - see the
+ # equivalent comment in signin.yaml. Let the scroll settle before tapping.
+ - waitForAnimationToEnd:
+ timeout: 3000
+ - tapOn: 'Sign out'
+ - extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 20000
+
+# The CI emulator's own home-screen launcher, not the app under test, occasionally ANRs right
+# after a cold launchApp - debug screenshots from a failure here showed the landing screen fully
+# rendered ("Get started"/"Sign in" both visible) underneath a "Pixel Launcher isn't responding"
+# system dialog, which blocks it from the view hierarchy Maestro actually queries. No timeout
+# budget fixes this - the dialog sits there until dismissed, however long you wait.
+#
+# A single check-then-wait isn't enough either: the launcher has been observed to still be
+# unresponsive (or to ANR again) *after* a check here found no dialog yet, so the assertion below
+# still hit it. Loop the check-and-dismiss with the wait, so a dialog appearing anywhere in the
+# window - not just at the instant this first runs - still gets caught on the next attempt. Tap
+# "Wait" to let the launcher recover rather than closing anything.
+# The pattern has to match the element's *whole* text, not appear somewhere inside it. Maestro
+# compiles a text selector into a full-match regex, so the bare "isn't responding" used here
+# previously never matched the dialog's actual title, "Pixel Launcher isn't responding": the
+# conditional recorded itself as SKIPPED on every attempt while the dialog sat on screen, and
+# the assertion below failed anyway. The `.*` either side are what make it fire.
+- retry:
+ maxRetries: 3
+ commands:
+ - runFlow:
+ when:
+ visible: ".*isn't responding.*"
+ commands:
+ - tapOn: 'Wait'
+
+ # A bare assertVisible relies on Maestro's short default lookup timeout, which is not
+ # always enough for the landing screen to render on a loaded CI emulator/simulator - wait
+ # explicitly. Optional, because a landing screen that never arrives is handled just below.
+ - extendedWaitUntil:
+ visible: 'Sign in'
+ timeout: 15000
+ optional: true
+
+ # `launchApp: clearState: true` can lose a race with its own cleanup on a slow emulator.
+ # Clearing the data removes the app's task, and when that removal times out the system kills
+ # the package's process - by then the freshly launched one. Device logs from a failed run
+ # show "Destroy timeout of remove-task" followed by "Killing ... remove task" a
+ # fraction of a second after launch, leaving a blank window that waiting never fixes.
+ # Relaunching recovers it. The data is already cleared, so this launch does not clear it
+ # again and cannot trigger the same race.
+ - runFlow:
+ when:
+ notVisible: 'Sign in'
+ commands:
+ - launchApp
+ - extendedWaitUntil:
+ visible: 'Sign in'
+ timeout: 15000
diff --git a/tests/e2e/quickstarts/quickstart-android-e2e/run-e2e.sh b/tests/e2e/quickstarts/quickstart-android-e2e/run-e2e.sh
new file mode 100755
index 0000000..fde96a5
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-android-e2e/run-e2e.sh
@@ -0,0 +1,86 @@
+#!/usr/bin/env bash
+# Copyright 2026 The ThunderID Authors
+# SPDX-License-Identifier: Apache-2.0
+#
+# Runs the quickstarts/quickstart-android E2E suite: starts a ThunderID server (or reuses one),
+# provisions the test application and user, builds the sample from this repository, installs it
+# on a running Android emulator, and drives it with Maestro. Every stage is idempotent, so re-running is
+# the normal way to iterate.
+#
+# Usage:
+# ./run-e2e.sh Everything
+# ./run-e2e.sh --skip-server Server already running and provisioned
+# ./run-e2e.sh --skip-build Sample already installed on the device
+# ./run-e2e.sh flows/signin.yaml Run one flow instead of the whole suite
+#
+# Any other argument is passed through to Maestro.
+#
+# Environment:
+# SAMPLES_ROOT The samples checkout to build the sample from (default: this repository)
+# (A running Android emulator, reachable with adb, is required.)
+# E2E_USERNAME Test user (default e2e_mobile_user)
+# E2E_PASSWORD Test user password (default TestPassword@123)
+# SERVER_URL, ADMIN_USERNAME, ADMIN_PASSWORD, THUNDERID_VERSION: see ../../shared/scripts/thunderid.sh
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+E2E_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
+THUNDERID="$E2E_ROOT/shared/scripts/thunderid.sh"
+SAMPLES_ROOT="${SAMPLES_ROOT:-$(cd "$E2E_ROOT/../.." && pwd)}"
+SAMPLE_DIR="$SAMPLES_ROOT/quickstarts/quickstart-android"
+CONFIG_FILE="$SAMPLE_DIR/thunderid-config/thunderid-config.yaml"
+
+export SERVER_URL="${SERVER_URL:-https://localhost:8090}"
+E2E_USER="${E2E_USERNAME:-e2e_mobile_user}"
+E2E_PASS="${E2E_PASSWORD:-TestPassword@123}"
+
+# Must match the `id` in $CONFIG_FILE.
+APP_ID="019e5b10-1001-7a2b-9c3d-4e5f60718293"
+
+do_server=true
+do_build=true
+maestro_args=()
+for arg in "$@"; do
+ case "$arg" in
+ --skip-server) do_server=false ;;
+ --skip-build) do_build=false ;;
+ -h | --help) sed -n '5,24p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
+ *) maestro_args+=("$arg") ;;
+ esac
+done
+
+# shellcheck source=../../shared/scripts/mobile.sh
+source "$E2E_ROOT/shared/scripts/mobile.sh"
+
+# The Android emulator spawns crashpad_handler as a detached child that outlives it, which can
+# deadlock reactivecircus/android-emulator-runner's shutdown in CI
+# (ReactiveCircus/android-emulator-runner#385). Stopping it on exit is the known workaround.
+terminate_crashpad_handler() {
+ pkill -SIGTERM crashpad_handler 2>/dev/null || true
+ sleep 5
+ pkill -SIGKILL crashpad_handler 2>/dev/null || true
+}
+trap terminate_crashpad_handler EXIT
+
+build_sample() {
+ echo "==> Configuring the sample"
+ # 10.0.2.2 is the emulator's alias for the host loopback, where the server listens. The debug
+ # build sets allowInsecureConnections, which lets the app accept the self-signed certificate.
+ local host_url
+ host_url=$(sed -E 's#://(localhost|127\.0\.0\.1)#://10.0.2.2#' <<<"$SERVER_URL")
+ cat >"$SAMPLE_DIR/config.properties" < Building and installing the sample"
+ (cd "$SAMPLE_DIR" && ./gradlew installDebug)
+}
+
+$do_server && provision_mobile_app "$CONFIG_FILE" "$APP_ID"
+command -v adb >/dev/null 2>&1 || { echo "ERROR: adb is required (Android SDK platform-tools)." >&2; exit 1; }
+$do_build && build_sample
+run_flows --platform android
diff --git a/tests/e2e/quickstarts/quickstart-browser-e2e/README.md b/tests/e2e/quickstarts/quickstart-browser-e2e/README.md
new file mode 100644
index 0000000..1d03f9a
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-browser-e2e/README.md
@@ -0,0 +1,22 @@
+# ThunderID Browser Quickstart E2E
+
+Playwright suite for [`quickstarts/quickstart-browser`](../../../../quickstarts/quickstart-browser). It starts the sample from its own sources with its published SDK, signs in against a real ThunderID server, and checks:
+
+- Sign in and sign out through the redirect flow
+- The token debug page shows a valid access token
+- Profile edits on the Account page are saved
+- A password change on the Security tab takes effect and can be reverted, and the form stays disabled until both values match
+
+## Run
+
+Start a ThunderID server first (see the [E2E README](../../README.md)), then, from `tests/e2e`:
+
+```bash
+npm ci
+npx playwright install chromium
+npm test -w quickstarts/quickstart-browser-e2e
+```
+
+Playwright installs the sample with `npm ci` when it has no `node_modules`, and serves it on port 5173 with the OAuth2 client `JS_SDK_E2E_BROWSER`. The global setup imports that client and creates the test users. Set `SAMPLES_ROOT` to run against another samples checkout, such as a `git archive` export.
+
+Port 5173 is shared with `quickstart-react-b2b`, so the two suites cannot run at the same time.
diff --git a/tests/e2e/quickstarts/quickstart-browser-e2e/fixtures.ts b/tests/e2e/quickstarts/quickstart-browser-e2e/fixtures.ts
new file mode 100644
index 0000000..54b2408
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-browser-e2e/fixtures.ts
@@ -0,0 +1,13 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {test as base} from '@playwright/test';
+import {BrowserQuickstartPage} from './pages/browser-quickstart.page.ts';
+
+export const test = base.extend<{browserQuickstartPage: BrowserQuickstartPage}>({
+ browserQuickstartPage: async ({page}, use) => {
+ await use(new BrowserQuickstartPage(page));
+ },
+});
+
+export {expect} from '@playwright/test';
diff --git a/tests/e2e/quickstarts/quickstart-browser-e2e/package.json b/tests/e2e/quickstarts/quickstart-browser-e2e/package.json
new file mode 100644
index 0000000..6f6399e
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-browser-e2e/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@thunderid/quickstart-browser-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "E2E suite of quickstarts/quickstart-browser",
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+}
diff --git a/tests/e2e/quickstarts/quickstart-browser-e2e/pages/browser-quickstart.page.ts b/tests/e2e/quickstarts/quickstart-browser-e2e/pages/browser-quickstart.page.ts
new file mode 100644
index 0000000..7a3a209
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-browser-e2e/pages/browser-quickstart.page.ts
@@ -0,0 +1,154 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * quickstarts/quickstart-browser Page Object - vanilla JS + @thunderid/browser, redirect flow.
+ * Custom hand-built markup (not the shared component library), so its own selectors: see
+ * src/components/nav.js and src/pages/home.js.
+ */
+
+import {Page, expect} from '@playwright/test';
+import {GateLoginPage} from '../../../shared/pages/gate-login.page.ts';
+import {Timeouts} from '../../../shared/constants/timeouts.ts';
+
+export const ProfileFieldKeys = {
+ familyName: 'family_name',
+ givenName: 'given_name',
+};
+
+export class BrowserQuickstartPage extends GateLoginPage {
+ constructor(page: Page) {
+ super(page);
+ }
+
+ async goto(url: string): Promise {
+ await this.page.goto(url, {waitUntil: 'commit'});
+ }
+
+ async verifyHomePageLoaded(): Promise {
+ await expect(this.page.locator('#hero-sign-in-btn, #sign-in-btn').first()).toBeVisible({
+ timeout: Timeouts.ELEMENT_VISIBILITY,
+ });
+ }
+
+ async clickSignInButton(): Promise {
+ await this.page.locator('#hero-sign-in-btn, #sign-in-btn').first().click();
+ }
+
+ async verifyLoggedIn(): Promise {
+ await expect(this.page.locator('#ud-trigger')).toBeVisible({timeout: Timeouts.REDIRECT});
+ }
+
+ async verifyLoggedOut(): Promise {
+ await this.verifyHomePageLoaded();
+ }
+
+ async logout(): Promise {
+ await this.page.locator('#ud-trigger').click();
+ await this.page.locator('#ud-sign-out').click();
+ await this.confirmSignOutIfPrompted();
+ }
+
+ /** Opens the token debug page via the user dropdown (src/pages/token.js - an in-memory SPA
+ * "route" with no real URL change, so callers must wait for its content, not a URL). */
+ async openTokenDebug(): Promise {
+ await this.page.locator('#ud-trigger').click();
+ await this.page.locator('#ud-token-debug').click();
+ }
+
+ async verifyTokenDebugLoaded(): Promise {
+ await expect(this.page.locator('.token-main')).toBeVisible({timeout: Timeouts.ELEMENT_VISIBILITY});
+ }
+
+ /** Reads the raw access token JWT rendered across the three .token-part--* spans. */
+ async getDisplayedAccessToken(): Promise {
+ const raw = this.page.locator('.token-raw');
+ await raw.waitFor({state: 'visible', timeout: Timeouts.ELEMENT_VISIBILITY});
+ const header = await raw.locator('.token-part--header').innerText();
+ const payload = await raw.locator('.token-part--payload').innerText();
+ const signature = await raw.locator('.token-part--signature').innerText();
+ return `${header}.${payload}.${signature}`;
+ }
+
+ /** Opens the "Manage Account" page (src/pages/account.js) via the nav dropdown, then switches
+ * to its Personal info tab - the account page lands on the Home tab first, same as
+ * the React and Vue quickstarts' own Account page. Replaces the old "Manage Profile" popup; the field
+ * rendering/editing logic that used to back that popup (src/components/profileDialog.js) was
+ * kept and repurposed to feed this page's Personal info tab instead (renamed to
+ * profileFields.js). */
+ async openManageProfile(): Promise {
+ await this.page.locator('#ud-trigger').click();
+ await this.page.locator('#ud-manage-profile').click();
+ await this.page.locator('.account-nav-item[data-tab="personal"]').click();
+ await this.page.locator('#profile-field-list').waitFor({state: 'visible', timeout: Timeouts.ELEMENT_VISIBILITY});
+ }
+
+ /** Edits one field of the Personal info tab, which renders each schema attribute as its own
+ * row with a pencil "Edit" button. */
+ async editProfileField(fieldKey: string, value: string): Promise {
+ const row = this.page.locator(`.profile-field-row[data-field="${fieldKey}"]`);
+ await row.locator('[data-action="edit"]').click();
+ await row.locator('.profile-field-row-input').fill(value);
+ await row.locator('[data-action="save"]').click();
+ await expect(row.locator('.profile-field-row-input')).toHaveCount(0, {timeout: Timeouts.DEFAULT_ACTION});
+ }
+
+ /** Verifies a field's row reverted from edit mode back to display mode showing the just-saved value*/
+ async verifyProfileFieldValue(fieldKey: string, value: string): Promise {
+ const row = this.page.locator(`.profile-field-row[data-field="${fieldKey}"]`);
+ await expect(row.locator('.profile-field-row-value')).toHaveText(value, {timeout: Timeouts.ELEMENT_VISIBILITY});
+ }
+
+ /** Leaves the Account page via the nav's "‹ Home" back link, same as closing the old dialog
+ * used to return control to the main app shell. */
+ async closeManageProfile(): Promise {
+ await this.page.locator('#nav-back-btn').click();
+ await this.page.locator('#profile-field-list').waitFor({state: 'hidden', timeout: Timeouts.DEFAULT_ACTION});
+ }
+
+ /** Opens the Account page and switches to its Security tab, where each credential renders as
+ * a collapsed row (src/pages/account.js's `renderCredentialCard`) that expands into the real
+ * form - see {@link changeCredential}. */
+ async openSecurityTab(): Promise {
+ await this.page.locator('#ud-trigger').click();
+ await this.page.locator('#ud-manage-profile').click();
+ await this.page.locator('.account-nav-item[data-tab="security"]').click();
+ await this.page.locator('.account-security-list').waitFor({state: 'visible', timeout: Timeouts.ELEMENT_VISIBILITY});
+ }
+
+ /** Expands or collapses the named credential's row - the same button does both, keyed by the
+ * schema attribute (`"password"`) rather than its label. Call {@link openSecurityTab} first. */
+ async toggleCredential(attribute: string): Promise {
+ await this.page.locator(`[data-cred-toggle="${attribute}"]`).click();
+ }
+
+ /** Fills the currently-open credential form's new-value and confirmation fields, without
+ * submitting. */
+ async fillCredentialFields(newValue: string, confirmValue: string): Promise {
+ await this.page.locator('[data-cred-field="newValue"]').fill(newValue);
+ await this.page.locator('[data-cred-field="confirmValue"]').fill(confirmValue);
+ }
+
+ /** Whether the currently-open credential form's submit button is disabled. */
+ async isCredentialSubmitDisabled(): Promise {
+ return this.page.locator('[data-cred-submit]').isDisabled();
+ }
+
+ /** Expands the named credential's row, fills the new value and its confirmation, and
+ * submits. Waits for the row to collapse back afterward, which is this sample's own
+ * `onDone` behavior on a successful write - proof the change actually succeeded server-side
+ * rather than just that the button was clicked. Call {@link openSecurityTab} first. */
+ async changeCredential(attribute: string, newValue: string): Promise {
+ const toggle = this.page.locator(`[data-cred-toggle="${attribute}"]`);
+ await toggle.click();
+
+ await this.fillCredentialFields(newValue, newValue);
+ await this.page.locator('[data-cred-submit]').click();
+
+ await expect(toggle).toHaveAttribute('aria-expanded', 'false', {timeout: Timeouts.ELEMENT_VISIBILITY});
+ }
+
+ async verifyDisplayedName(fullName: string): Promise {
+ await expect(this.page.locator('.ud-name')).toHaveText(fullName, {timeout: Timeouts.ELEMENT_VISIBILITY});
+ }
+}
diff --git a/tests/e2e/quickstarts/quickstart-browser-e2e/playwright.config.ts b/tests/e2e/quickstarts/quickstart-browser-e2e/playwright.config.ts
new file mode 100644
index 0000000..0edc8af
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-browser-e2e/playwright.config.ts
@@ -0,0 +1,18 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {sharedClientVariable} from '../../shared/apps.ts';
+import {defineSampleConfig, sampleWebServer} from '../../shared/playwright.ts';
+
+const config = defineSampleConfig({
+ app: 'BROWSER',
+ webServer: sampleWebServer('BROWSER', {
+ command: 'npm run dev -- --port 5173 --strictPort',
+ env: {
+ VITE_THUNDERID_BASE_URL: process.env.SERVER_URL!,
+ VITE_THUNDERID_CLIENT_ID: sharedClientVariable('BROWSER_CLIENT_ID'),
+ },
+ }),
+});
+
+export default config;
diff --git a/tests/e2e/quickstarts/quickstart-browser-e2e/tests/change-credential.spec.ts b/tests/e2e/quickstarts/quickstart-browser-e2e/tests/change-credential.spec.ts
new file mode 100644
index 0000000..250df7c
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-browser-e2e/tests/change-credential.spec.ts
@@ -0,0 +1,94 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * browser/quickstart - changing a credential (password) via the Account page's Security tab.
+ * See quickstart-browser-e2e/tests/sign-in-out.spec.ts for the rest of the prerequisites.
+ *
+ * Signs in as a dedicated credential-test user (see credentialTestUser in shared/apps.ts),
+ * distinct from the shared TEST_USER_USERNAME every sign-in-out spec uses: TC001 below changes
+ * this user's password and changes it back (see the `finally` block), and the suite runs
+ * `fullyParallel`, so mutating the shared user's password would race every other
+ * concurrently-running spec's login across every app. The two tests in this file are run
+ * serially (below) so they don't race each other over their own shared dedicated user either.
+ */
+
+import {credentialTestUser, SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {expect, test} from '../fixtures.ts';
+import {setUserPassword} from '../../../shared/utils/users-api/index.ts';
+
+const appUrl = sampleAppUrl(SampleApps.BROWSER);
+const {username, password} = credentialTestUser(SampleApps.BROWSER);
+// Derived from the real password rather than hardcoded, so this works regardless of what
+// policy the schema's password attribute is configured with in a given environment.
+const tempPassword = `${password}-Tmp1!`;
+
+test.describe.configure({mode: 'serial'});
+
+test.describe('browser/quickstart - Change credential', () => {
+ test.beforeEach(() => setUserPassword(username, password));
+
+ test('TC001: a password change via the Security tab takes effect and can be reverted', async ({
+ browserQuickstartPage,
+ }) => {
+ await browserQuickstartPage.goto(appUrl);
+ await browserQuickstartPage.verifyHomePageLoaded();
+ await browserQuickstartPage.clickSignInButton();
+ await browserQuickstartPage.verifyLoginPageLoaded();
+ await browserQuickstartPage.login(username, password);
+ await browserQuickstartPage.verifyLoggedIn();
+
+ await browserQuickstartPage.openSecurityTab();
+
+ try {
+ await browserQuickstartPage.changeCredential('password', tempPassword);
+
+ // Prove the change landed server-side, not just that the UI collapsed the form: sign
+ // out and back in using the new password.
+ await browserQuickstartPage.logout();
+ await browserQuickstartPage.verifyLoggedOut();
+
+ await browserQuickstartPage.clickSignInButton();
+ await browserQuickstartPage.verifyLoginPageLoaded();
+ await browserQuickstartPage.login(username, tempPassword);
+ await browserQuickstartPage.verifyLoggedIn();
+
+ await browserQuickstartPage.openSecurityTab();
+ } finally {
+ // Always attempt to restore the shared test user's original password, even if an
+ // assertion above failed.
+ await browserQuickstartPage.changeCredential('password', password);
+ }
+
+ // The restore itself also has to have actually worked, or the next test to sign in with
+ // the original password would fail.
+ await browserQuickstartPage.logout();
+ await browserQuickstartPage.verifyLoggedOut();
+ await browserQuickstartPage.clickSignInButton();
+ await browserQuickstartPage.verifyLoginPageLoaded();
+ await browserQuickstartPage.login(username, password);
+ await browserQuickstartPage.verifyLoggedIn();
+ });
+
+ test('TC002: the submit button stays disabled until the new value and confirmation match', async ({
+ browserQuickstartPage,
+ }) => {
+ await browserQuickstartPage.goto(appUrl);
+ await browserQuickstartPage.verifyHomePageLoaded();
+ await browserQuickstartPage.clickSignInButton();
+ await browserQuickstartPage.verifyLoginPageLoaded();
+ await browserQuickstartPage.login(username, password);
+ await browserQuickstartPage.verifyLoggedIn();
+
+ await browserQuickstartPage.openSecurityTab();
+ await browserQuickstartPage.toggleCredential('password');
+
+ expect(await browserQuickstartPage.isCredentialSubmitDisabled()).toBe(true);
+
+ await browserQuickstartPage.fillCredentialFields('mismatch-one', 'mismatch-two');
+ expect(await browserQuickstartPage.isCredentialSubmitDisabled()).toBe(true);
+
+ // Collapse without submitting - nothing was written, so there is nothing to restore.
+ await browserQuickstartPage.toggleCredential('password');
+ });
+});
diff --git a/tests/e2e/quickstarts/quickstart-browser-e2e/tests/sign-in-out.spec.ts b/tests/e2e/quickstarts/quickstart-browser-e2e/tests/sign-in-out.spec.ts
new file mode 100644
index 0000000..5303eac
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-browser-e2e/tests/sign-in-out.spec.ts
@@ -0,0 +1,79 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * browser/quickstart - sign in and sign out via the redirect flow (vanilla JS + @thunderid/browser).
+ * See quickstart-react-e2e/tests/sign-in-out.spec.ts for the rest of the prerequisites.
+ */
+
+import {SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {expect, test} from '../fixtures.ts';
+import {ProfileFieldKeys} from '../pages/browser-quickstart.page.ts';
+import {decodeJwtPayload} from '../../../shared/utils/jwt/index.ts';
+
+const appUrl = sampleAppUrl(SampleApps.BROWSER);
+const username = process.env.TEST_USER_USERNAME!;
+const password = process.env.TEST_USER_PASSWORD!;
+
+test.describe('browser/quickstart - Sign in and Sign out', () => {
+ test('TC001: signs in with valid credentials', async ({browserQuickstartPage}) => {
+ await browserQuickstartPage.goto(appUrl);
+ await browserQuickstartPage.verifyHomePageLoaded();
+
+ await browserQuickstartPage.clickSignInButton();
+ await browserQuickstartPage.verifyLoginPageLoaded();
+
+ await browserQuickstartPage.login(username, password);
+ await browserQuickstartPage.verifyLoggedIn();
+ });
+
+ test('TC002: signs out after a successful sign-in', async ({browserQuickstartPage}) => {
+ await browserQuickstartPage.goto(appUrl);
+ await browserQuickstartPage.verifyHomePageLoaded();
+ await browserQuickstartPage.clickSignInButton();
+ await browserQuickstartPage.verifyLoginPageLoaded();
+ await browserQuickstartPage.login(username, password);
+ await browserQuickstartPage.verifyLoggedIn();
+
+ await browserQuickstartPage.logout();
+ await browserQuickstartPage.verifyLoggedOut();
+ });
+
+ test('TC003: token debug page displays a valid access token', async ({browserQuickstartPage}) => {
+ await browserQuickstartPage.goto(appUrl);
+ await browserQuickstartPage.verifyHomePageLoaded();
+ await browserQuickstartPage.clickSignInButton();
+ await browserQuickstartPage.verifyLoginPageLoaded();
+ await browserQuickstartPage.login(username, password);
+ await browserQuickstartPage.verifyLoggedIn();
+
+ await browserQuickstartPage.openTokenDebug();
+ await browserQuickstartPage.verifyTokenDebugLoaded();
+
+ const token = await browserQuickstartPage.getDisplayedAccessToken();
+ expect(token.split('.')).toHaveLength(3);
+
+ const payload = decodeJwtPayload(token);
+ expect(payload.sub).toBeTruthy();
+ expect(payload.exp as number).toBeGreaterThan(Math.floor(Date.now() / 1000));
+ });
+
+ test('TC004: profile changes made via Manage Profile are reflected', async ({browserQuickstartPage}) => {
+ await browserQuickstartPage.goto(appUrl);
+ await browserQuickstartPage.verifyHomePageLoaded();
+ await browserQuickstartPage.clickSignInButton();
+ await browserQuickstartPage.verifyLoginPageLoaded();
+ await browserQuickstartPage.login(username, password);
+ await browserQuickstartPage.verifyLoggedIn();
+
+ await browserQuickstartPage.openManageProfile();
+ await browserQuickstartPage.editProfileField(ProfileFieldKeys.givenName, 'Profile');
+ await browserQuickstartPage.editProfileField(ProfileFieldKeys.familyName, 'Updated');
+
+ await browserQuickstartPage.verifyProfileFieldValue(ProfileFieldKeys.givenName, 'Profile');
+ await browserQuickstartPage.verifyProfileFieldValue(ProfileFieldKeys.familyName, 'Updated');
+
+ await browserQuickstartPage.closeManageProfile();
+ await browserQuickstartPage.verifyDisplayedName('Profile Updated');
+ });
+});
diff --git a/tests/e2e/quickstarts/quickstart-express-e2e/README.md b/tests/e2e/quickstarts/quickstart-express-e2e/README.md
new file mode 100644
index 0000000..81b0e24
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-express-e2e/README.md
@@ -0,0 +1,21 @@
+# ThunderID Express Quickstart E2E
+
+Playwright suite for [`quickstarts/quickstart-express`](../../../../quickstarts/quickstart-express). It starts the sample from its own sources with its published SDK, signs in against a real ThunderID server, and checks:
+
+- Sign in and sign out through the server-side redirect flow
+- The token debug page shows a valid access token
+- A password change through `PATCH /api/me/credentials` takes effect and can be reverted, and the route refuses an unauthenticated call
+
+## Run
+
+Start a ThunderID server first (see the [E2E README](../../README.md)), then, from `tests/e2e`:
+
+```bash
+npm ci
+npx playwright install chromium
+npm test -w quickstarts/quickstart-express-e2e
+```
+
+Playwright installs the sample with `npm ci` when it has no `node_modules`, and serves it on port 3000 with the OAuth2 client `JS_SDK_E2E_EXPRESS`. The global setup imports that client and creates the test users. Set `SAMPLES_ROOT` to run against another samples checkout, such as a `git archive` export.
+
+The sample listens on port 3000, which `quickstart-nextjs-b2b` and `wayfinder-enterprise-nextjs` also need, so these suites cannot run at the same time.
diff --git a/tests/e2e/quickstarts/quickstart-express-e2e/fixtures.ts b/tests/e2e/quickstarts/quickstart-express-e2e/fixtures.ts
new file mode 100644
index 0000000..9987073
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-express-e2e/fixtures.ts
@@ -0,0 +1,13 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {test as base} from '@playwright/test';
+import {ExpressQuickstartPage} from './pages/express-quickstart.page.ts';
+
+export const test = base.extend<{expressQuickstartPage: ExpressQuickstartPage}>({
+ expressQuickstartPage: async ({page}, use) => {
+ await use(new ExpressQuickstartPage(page));
+ },
+});
+
+export {expect} from '@playwright/test';
diff --git a/tests/e2e/quickstarts/quickstart-express-e2e/package.json b/tests/e2e/quickstarts/quickstart-express-e2e/package.json
new file mode 100644
index 0000000..183e1ab
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-express-e2e/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@thunderid/quickstart-express-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "E2E suite of quickstarts/quickstart-express",
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+}
diff --git a/tests/e2e/quickstarts/quickstart-express-e2e/pages/express-quickstart.page.ts b/tests/e2e/quickstarts/quickstart-express-e2e/pages/express-quickstart.page.ts
new file mode 100644
index 0000000..3d9c571
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-express-e2e/pages/express-quickstart.page.ts
@@ -0,0 +1,67 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * quickstarts/quickstart-express Page Object - server-rendered Express app + @thunderid/express, cookie
+ * session. No client SDK, plain server-rendered markup (a native dropdown), so its own
+ * selectors: see lib/layout.mjs.
+ */
+
+import {Page, expect} from '@playwright/test';
+import {GateLoginPage} from '../../../shared/pages/gate-login.page.ts';
+import {Timeouts} from '../../../shared/constants/timeouts.ts';
+
+export class ExpressQuickstartPage extends GateLoginPage {
+ constructor(page: Page) {
+ super(page);
+ }
+
+ async goto(url: string): Promise {
+ await this.page.goto(url, {waitUntil: 'commit'});
+ }
+
+ async verifyHomePageLoaded(): Promise {
+ await expect(this.page.locator('a.btn-primary[href="/login"]')).toBeVisible({
+ timeout: Timeouts.ELEMENT_VISIBILITY,
+ });
+ }
+
+ async clickSignInButton(): Promise {
+ await this.page.locator('a.btn-primary[href="/login"]').click();
+ }
+
+ async verifyLoggedIn(): Promise {
+ await expect(this.page.locator('.user-menu-trigger')).toBeVisible({timeout: Timeouts.REDIRECT});
+ }
+
+ async verifyLoggedOut(): Promise {
+ await this.verifyHomePageLoaded();
+ }
+
+ async logout(): Promise {
+ await this.page.locator('.user-menu-trigger').click();
+ await this.page.locator('a.user-menu-item[href="/logout"]').click();
+ await this.confirmSignOutIfPrompted();
+ }
+
+ /** Opens the token debug page via the user menu's "Token debug" link (see lib/layout.mjs). */
+ async openTokenDebug(): Promise {
+ await this.page.locator('.user-menu-trigger').click();
+ await this.page.locator('a.user-menu-item[href="/token"]').click();
+ }
+
+ async verifyTokenDebugLoaded(): Promise {
+ await expect(this.page.locator('.token-raw')).toBeVisible({timeout: Timeouts.ELEMENT_VISIBILITY});
+ }
+
+ /** Reads the raw access token JWT rendered across the three .token-part--* spans - see
+ * index.mjs's /token handler. */
+ async getDisplayedAccessToken(): Promise {
+ const raw = this.page.locator('.token-raw');
+ await raw.waitFor({state: 'visible', timeout: Timeouts.ELEMENT_VISIBILITY});
+ const header = await raw.locator('.token-part--header').innerText();
+ const payload = await raw.locator('.token-part--payload').innerText();
+ const signature = await raw.locator('.token-part--signature').innerText();
+ return `${header}.${payload}.${signature}`;
+ }
+}
diff --git a/tests/e2e/quickstarts/quickstart-express-e2e/playwright.config.ts b/tests/e2e/quickstarts/quickstart-express-e2e/playwright.config.ts
new file mode 100644
index 0000000..4f327af
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-express-e2e/playwright.config.ts
@@ -0,0 +1,22 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {sharedClientVariable} from '../../shared/apps.ts';
+import {defineSampleConfig, sampleWebServer} from '../../shared/playwright.ts';
+
+// The sample listens on a fixed port, 3000.
+
+const config = defineSampleConfig({
+ app: 'EXPRESS',
+ webServer: sampleWebServer('EXPRESS', {
+ command: 'npm start',
+ env: {
+ NODE_TLS_REJECT_UNAUTHORIZED: '0',
+ THUNDERID_BASE_URL: process.env.SERVER_URL!,
+ THUNDERID_CLIENT_ID: sharedClientVariable('EXPRESS_CLIENT_ID'),
+ THUNDERID_CLIENT_SECRET: sharedClientVariable('EXPRESS_CLIENT_SECRET'),
+ },
+ }),
+});
+
+export default config;
diff --git a/tests/e2e/quickstarts/quickstart-express-e2e/tests/change-credential.spec.ts b/tests/e2e/quickstarts/quickstart-express-e2e/tests/change-credential.spec.ts
new file mode 100644
index 0000000..9ebe703
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-express-e2e/tests/change-credential.spec.ts
@@ -0,0 +1,99 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * express/quickstart - updating a credential (password) via the sample's own
+ * `PATCH /api/me/credentials` route. Unlike react/vue/nextjs/nuxt/browser, express/quickstart
+ * has no profile UI at all (see sign-in-out.spec.ts's own note on this), so there is no Security
+ * tab to drive here: this calls the route directly with the access token read off the existing
+ * Token debug page, the same token every other spec in this file already exercises.
+ *
+ * Signs in as a dedicated credential-test user (see credentialTestUser in shared/apps.ts),
+ * distinct from the shared TEST_USER_USERNAME every sign-in-out spec uses: TC001 below changes
+ * this user's password and changes it back (see the `finally` block), and the suite runs
+ * `fullyParallel`, so mutating the shared user's password would race every other
+ * concurrently-running spec's login across every app.
+ */
+
+import {APIRequestContext} from '@playwright/test';
+import {credentialTestUser, SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {expect, test} from '../fixtures.ts';
+import {setUserPassword} from '../../../shared/utils/users-api/index.ts';
+
+const appUrl = sampleAppUrl(SampleApps.EXPRESS);
+const {username, password} = credentialTestUser(SampleApps.EXPRESS);
+// Derived from the real password rather than hardcoded, so this works regardless of what
+// policy the schema's password attribute is configured with in a given environment.
+const tempPassword = `${password}-Tmp1!`;
+
+function updateCredentials(request: APIRequestContext, accessToken: string, newPassword: string) {
+ return request.patch(`${appUrl}/api/me/credentials`, {
+ data: {password: newPassword},
+ headers: {Authorization: `Bearer ${accessToken}`},
+ });
+}
+
+// Both tests reset the dedicated user's password before they start, so they must not overlap.
+test.describe.configure({mode: 'serial'});
+
+test.describe('express/quickstart - Change credential', () => {
+ test.beforeEach(() => setUserPassword(username, password));
+
+ test('TC001: a password change via PATCH /api/me/credentials takes effect and can be reverted', async ({
+ expressQuickstartPage,
+ request,
+ }) => {
+ await expressQuickstartPage.goto(appUrl);
+ await expressQuickstartPage.verifyHomePageLoaded();
+ await expressQuickstartPage.clickSignInButton();
+ await expressQuickstartPage.verifyLoginPageLoaded();
+ await expressQuickstartPage.login(username, password);
+ await expressQuickstartPage.verifyLoggedIn();
+
+ try {
+ await expressQuickstartPage.openTokenDebug();
+ await expressQuickstartPage.verifyTokenDebugLoaded();
+ const accessToken = await expressQuickstartPage.getDisplayedAccessToken();
+
+ const changeResponse = await updateCredentials(request, accessToken, tempPassword);
+ expect(changeResponse.status()).toBe(204);
+
+ // Prove the change landed server-side, not just that the route returned 204: sign out
+ // and back in using the new password.
+ await expressQuickstartPage.logout();
+ await expressQuickstartPage.verifyLoggedOut();
+
+ await expressQuickstartPage.clickSignInButton();
+ await expressQuickstartPage.verifyLoginPageLoaded();
+ await expressQuickstartPage.login(username, tempPassword);
+ await expressQuickstartPage.verifyLoggedIn();
+ } finally {
+ // Always attempt to restore the shared test user's original password, even if an
+ // assertion above failed. Re-open the Token debug page rather than assuming the try block
+ // left us there: if it failed before reaching that point, the page could still be on the
+ // login page or a stale session, and reading the token would hang or return the wrong one.
+ await expressQuickstartPage.openTokenDebug();
+ await expressQuickstartPage.verifyTokenDebugLoaded();
+ const revertToken = await expressQuickstartPage.getDisplayedAccessToken();
+
+ const revertResponse = await updateCredentials(request, revertToken, password);
+ expect(revertResponse.status()).toBe(204);
+ }
+
+ // The restore itself also has to have actually worked, or the next test to sign in with
+ // the original password would fail.
+ await expressQuickstartPage.logout();
+ await expressQuickstartPage.verifyLoggedOut();
+ await expressQuickstartPage.clickSignInButton();
+ await expressQuickstartPage.verifyLoginPageLoaded();
+ await expressQuickstartPage.login(username, password);
+ await expressQuickstartPage.verifyLoggedIn();
+ });
+
+ test('TC002: rejects an unauthenticated request', async ({request}) => {
+ const response = await request.patch(`${appUrl}/api/me/credentials`, {
+ data: {password: 'irrelevant'},
+ });
+ expect(response.status()).toBe(401);
+ });
+});
diff --git a/tests/e2e/quickstarts/quickstart-express-e2e/tests/sign-in-out.spec.ts b/tests/e2e/quickstarts/quickstart-express-e2e/tests/sign-in-out.spec.ts
new file mode 100644
index 0000000..30efe18
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-express-e2e/tests/sign-in-out.spec.ts
@@ -0,0 +1,63 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * express/quickstart - sign in and sign out via the redirect flow (server-rendered + cookie
+ * session, no client SDK). See quickstart-react-e2e/tests/sign-in-out.spec.ts for the rest of the
+ * prerequisites.
+ */
+
+import {SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {expect, test} from '../fixtures.ts';
+import {decodeJwtPayload} from '../../../shared/utils/jwt/index.ts';
+
+const appUrl = sampleAppUrl(SampleApps.EXPRESS);
+const username = process.env.TEST_USER_USERNAME!;
+const password = process.env.TEST_USER_PASSWORD!;
+
+test.describe('express/quickstart - Sign in and Sign out', () => {
+ test('TC001: signs in with valid credentials', async ({expressQuickstartPage}) => {
+ await expressQuickstartPage.goto(appUrl);
+ await expressQuickstartPage.verifyHomePageLoaded();
+
+ await expressQuickstartPage.clickSignInButton();
+ await expressQuickstartPage.verifyLoginPageLoaded();
+
+ await expressQuickstartPage.login(username, password);
+ await expressQuickstartPage.verifyLoggedIn();
+ });
+
+ test('TC002: signs out after a successful sign-in', async ({expressQuickstartPage}) => {
+ await expressQuickstartPage.goto(appUrl);
+ await expressQuickstartPage.verifyHomePageLoaded();
+ await expressQuickstartPage.clickSignInButton();
+ await expressQuickstartPage.verifyLoginPageLoaded();
+ await expressQuickstartPage.login(username, password);
+ await expressQuickstartPage.verifyLoggedIn();
+
+ await expressQuickstartPage.logout();
+ await expressQuickstartPage.verifyLoggedOut();
+ });
+
+ test('TC003: token debug page displays a valid access token', async ({expressQuickstartPage}) => {
+ await expressQuickstartPage.goto(appUrl);
+ await expressQuickstartPage.verifyHomePageLoaded();
+ await expressQuickstartPage.clickSignInButton();
+ await expressQuickstartPage.verifyLoginPageLoaded();
+ await expressQuickstartPage.login(username, password);
+ await expressQuickstartPage.verifyLoggedIn();
+
+ await expressQuickstartPage.openTokenDebug();
+ await expressQuickstartPage.verifyTokenDebugLoaded();
+
+ const token = await expressQuickstartPage.getDisplayedAccessToken();
+ expect(token.split('.')).toHaveLength(3);
+
+ const payload = decodeJwtPayload(token);
+ expect(payload.sub).toBeTruthy();
+ expect(payload.exp as number).toBeGreaterThan(Math.floor(Date.now() / 1000));
+ });
+
+ // No TC004 (profile management) here: express/quickstart's user menu only has "Token debug" and
+ // "Sign out" (see lib/layout.mjs) - no profile UI at all.
+});
diff --git a/tests/e2e/quickstarts/quickstart-flutter-e2e/README.md b/tests/e2e/quickstarts/quickstart-flutter-e2e/README.md
new file mode 100644
index 0000000..f6ff90d
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-flutter-e2e/README.md
@@ -0,0 +1,46 @@
+# ThunderID Flutter Quickstart E2E
+
+Maestro flows that drive [`quickstarts/quickstart-flutter`](../../../../quickstarts/quickstart-flutter) through real authentication against a real ThunderID server on an iOS Simulator. The sample is built from this repository with the SDK release it pins.
+
+| Flow | What it checks |
+| ------------------------------ | ----------------------------------------------------------------- |
+| `flows/signin.yaml` | Sign in through the server-driven credentials step, then sign out |
+| `flows/signup.yaml` | Register a new user, then sign in as them |
+| `flows/change-credential.yaml` | Change the password from Manage Account, then change it back |
+
+`flows/subflows/` holds the building blocks the flows share. The flows are the ones the SDK repository's suite ran, unchanged: each platform's UI differs enough (system dialogs, field ids, scrolling) that the three mobile suites keep their own flows.
+
+## Prerequisites
+
+Flutter, Xcode (with an iPhone simulator), [Maestro](https://maestro.mobile.dev/getting-started/installing-maestro), `curl`, `jq`, `openssl`, `unzip`.
+
+## Run
+
+```bash
+# Everything: start or reuse a server, provision it, build and install the sample, run the flows
+./run-e2e.sh
+
+# Iterate faster once the server is provisioned and the sample installed
+./run-e2e.sh --skip-server --skip-build
+
+# One flow
+./run-e2e.sh flows/signin.yaml
+```
+
+`run-e2e.sh` uses [`shared/scripts/thunderid.sh`](../../shared/scripts/thunderid.sh) to start the server (or reuse one already serving on `SERVER_URL`), imports the sample's own `thunderid-config/thunderid-config.yaml`, creates the test user `e2e_mobile_user` / `TestPassword@123`, then writes the sample's `.env`, builds it with `flutter build ios --debug --simulator`, installs it, and opens the sign-in form once untimed (`subflows/warm-up-trust.yaml`) so a freshly booted simulator finishes its first certificate trust evaluation before any flow starts its clock. Maestro writes a JUnit report to `report.xml`. Set `SAMPLES_ROOT` to build the sample from another samples checkout. The script writes the sample's local config file (git-ignored in the sample), so point `SAMPLES_ROOT` at a copy if you keep your own config there.
+
+Windows: the SDK repository's `run-e2e.ps1` is not ported; run the suite from macOS or Linux.
+
+These suites do not run in CI yet. Adding them, on macOS runners with a simulator and on Linux with an Android emulator, is a follow-up.
+
+## Things worth knowing
+
+**The application must be `type: mobile` with `attestation.devMode: true`.** A mobile application normally proves its binary identity through platform attestation before it can start a flow directly, and `/flow/execute` rejects it with `FES-1016` otherwise. Neither Apple App Attest nor Play Integrity works on an emulated device. `devMode` is test-only and must never be enabled on a real tenant.
+
+**`POST /import` drops the `attestation` block.** It reports success and stores `attestation: null`, so `run-e2e.sh` re-applies it over `PUT /applications/{id}`. Once the import keeps it, that step can go.
+
+**Sign-up does not sign the user in.** The registration flow completes without an assertion, so `signup.yaml` signs in afterwards with the new credentials, which also proves the account works. Each run leaves an `e2e_signup_` user on the server.
+
+**`change-credential.yaml` really changes the test user's password**, to a temporary value and back. If a run fails in between, re-running `change-credential.yaml` changes it back.
+
+**The flows run on iOS.** The sample's iOS target accepts the local server's self-signed certificate; its Android target has no equivalent.
diff --git a/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/change-credential.yaml b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/change-credential.yaml
new file mode 100644
index 0000000..3781ad7
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/change-credential.yaml
@@ -0,0 +1,119 @@
+appId: dev.thunderid.Quickstart
+name: Change password from the profile screen
+tags:
+ - account
+env:
+ E2E_USERNAME: e2e_mobile_user
+ E2E_PASSWORD: TestPassword@123
+ # This flow actually changes E2E_PASSWORD on the shared E2E user via the real backend (the
+ # self-service credential write path has no "current value" concept to gate this behind), so it
+ # changes to this value and back to E2E_PASSWORD before finishing. If this flow fails between
+ # those two steps, the E2E user is left on this password until the next run fixes it, not
+ # E2E_PASSWORD - see the closing comment for how a re-run recovers on its own.
+ E2E_TEMP_PASSWORD: TempPassword@456
+---
+- launchApp:
+ clearState: true
+- runFlow: subflows/ensure-signed-out.yaml
+
+- retry:
+ maxRetries: 2
+ commands:
+ - runFlow:
+ when:
+ notVisible: 'Sign in'
+ commands:
+ - launchApp:
+ clearState: true
+ - runFlow: subflows/ensure-signed-out.yaml
+ - tapOn: 'Sign in'
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 25000
+
+- waitForAnimationToEnd:
+ timeout: 3000
+
+- retry:
+ maxRetries: 2
+ commands:
+ - runFlow:
+ when:
+ notVisible:
+ id: 'thunderid-field-username'
+ commands:
+ - launchApp:
+ clearState: true
+ - runFlow: subflows/ensure-signed-out.yaml
+ - tapOn: 'Sign in'
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 25000
+ - waitForAnimationToEnd:
+ timeout: 3000
+
+ - tapOn:
+ id: 'thunderid-field-username'
+ - eraseText: 50
+ - inputText: ${E2E_USERNAME}
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-password'
+ timeout: 20000
+ - tapOn:
+ id: 'thunderid-field-password'
+ - eraseText: 50
+ - inputText: ${E2E_PASSWORD}
+ - tapOn:
+ id: 'thunderid-action-action_001'
+ - runFlow: subflows/dismiss-save-password.yaml
+ - extendedWaitUntil:
+ notVisible:
+ id: 'thunderid-field-username'
+ timeout: 20000
+ - assertNotVisible: '.*NETWORK_ERROR.*'
+
+- extendedWaitUntil:
+ visible: 'Session active'
+ timeout: 60000
+
+- tapOn: 'Manage Account'
+- extendedWaitUntil:
+ visible: 'Security'
+ timeout: 20000
+- tapOn: 'Security'
+
+# The ChangeCredential row's own tap target is targeted by id, not by the "Password" label or
+# "Edit" link text: every profile field row (and the credential row) renders an identical "Edit"
+# link, so text would be ambiguous between them.
+- runFlow: subflows/open-change-password.yaml
+
+# Change away from E2E_PASSWORD, then immediately back, so the E2E user's credential is unchanged
+# once this flow finishes, matching signin.yaml's "leaves the app as it found it" convention.
+- runFlow:
+ file: subflows/change-password-to.yaml
+ env:
+ NEW_PASSWORD: ${E2E_TEMP_PASSWORD}
+- runFlow: subflows/open-change-password.yaml
+- runFlow:
+ file: subflows/change-password-to.yaml
+ env:
+ NEW_PASSWORD: ${E2E_PASSWORD}
+
+# Back out through the section screen, then the manage account hub, to the home tab. Both back
+# controls are chevron-only (no label), so they're targeted by id rather than text - see
+# _BackChevron in the sample for why one shared id is unambiguous here.
+- tapOn:
+ id: 'thunderid-nav-back'
+- tapOn:
+ id: 'thunderid-nav-back'
+- scrollUntilVisible:
+ element: 'Sign out'
+ direction: DOWN
+ timeout: 20000
+- tapOn: 'Sign out'
+- extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 20000
diff --git a/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/config.yaml b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/config.yaml
new file mode 100644
index 0000000..20fcbb7
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/config.yaml
@@ -0,0 +1,6 @@
+# Maestro workspace configuration for the Flutter Quickstart E2E suite.
+#
+# Only the top-level flows are test entry points. Without this, `maestro test .maestro/` would
+# also recurse into subflows/ and run the shared building blocks as if they were tests.
+flows:
+ - '*.yaml'
diff --git a/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/signin.yaml b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/signin.yaml
new file mode 100644
index 0000000..cd8fc77
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/signin.yaml
@@ -0,0 +1,135 @@
+appId: dev.thunderid.Quickstart
+name: Sign in and sign out
+tags:
+ - auth
+env:
+ E2E_USERNAME: e2e_mobile_user
+ E2E_PASSWORD: TestPassword@123
+---
+- launchApp:
+ clearState: true
+- runFlow: subflows/ensure-signed-out.yaml
+
+# The credentials step is rendered from the flow definition the server returns, not from static
+# native views. The SDK tags each input with the field's identifier and each button with the
+# action's ref, so these ids track the server's flow response.
+#
+# Entering a flow makes the first `POST /flow/execute` call, and a connection dropped there
+# (NSURLErrorDomain -1005) leaves the app on an error sheet with the step never rendered. That
+# is a transport failure rather than a product one, and a real user would simply try again, so
+# retry the entry. A step that genuinely never renders still fails, after the retries.
+- retry:
+ maxRetries: 2
+ commands:
+ # A second attempt means the previous one left the app on the error sheet, which carries
+ # no control to dismiss it and no way back to the landing screen. Restart before trying
+ # again. On the first attempt "Sign in" is already on screen and this does nothing.
+ - runFlow:
+ when:
+ notVisible: 'Sign in'
+ commands:
+ - launchApp:
+ clearState: true
+ - runFlow: subflows/ensure-signed-out.yaml
+ - tapOn: 'Sign in'
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 25000
+
+# "Visible" fires the instant the field is on screen, which on a loaded CI runner can be before
+# the widget has actually finished settling (Flutter still completing its own build and layout
+# pass after the flow response arrives). Typing into a field that's mid-settle has been observed
+# to bind an empty string despite the keystrokes displaying correctly - the input lands, then
+# gets discarded when the widget finishes settling under it. Waiting for animations to end first
+# gives that settling a beat to finish before anything gets typed.
+- waitForAnimationToEnd:
+ timeout: 3000
+
+# A slow CI runner can take long enough filling and submitting this form that the server's
+# credentials-step challenge expires before submission, which silently resets the form instead
+# of authenticating - "Session active" then never appears. That is an expired challenge, not a
+# regression, so retry the fill-and-submit rather than fail outright.
+#
+# The retried view is not guaranteed to come back blank - a failed submission can just as easily
+# leave the previous attempt's text sitting in the field - so each retry erases before typing
+# rather than assuming an empty field.
+- retry:
+ maxRetries: 2
+ commands:
+ # A retry that follows a dropped connection has no form left to type into, only the error
+ # sheet, and that sheet carries no control to dismiss it. Restart and re-enter the flow
+ # first. On the first attempt, and on an expired-challenge retry, the form is still there
+ # and this does nothing.
+ - runFlow:
+ when:
+ notVisible:
+ id: 'thunderid-field-username'
+ commands:
+ - launchApp:
+ clearState: true
+ - runFlow: subflows/ensure-signed-out.yaml
+ - tapOn: 'Sign in'
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 25000
+ - waitForAnimationToEnd:
+ timeout: 3000
+
+ - tapOn:
+ id: 'thunderid-field-username'
+ - eraseText: 50
+ - inputText: ${E2E_USERNAME}
+
+ # tapOn's own element-lookup timeout is much shorter than extendedWaitUntil's, and is not
+ # always enough on a loaded CI runner, so wait explicitly rather than tap blind.
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-password'
+ timeout: 20000
+ - tapOn:
+ id: 'thunderid-field-password'
+ - eraseText: 50
+ - inputText: ${E2E_PASSWORD}
+
+ - tapOn:
+ id: 'thunderid-action-action_001'
+
+ - runFlow: subflows/dismiss-save-password.yaml
+
+ # What the retry is testing for is whether the submission was accepted at all, not whether
+ # the app reached the authenticated state. An expired challenge leaves the credentials step
+ # sitting on screen, and that is the case worth retrying. Waiting for the step to go away
+ # detects it without swallowing a later failure.
+ - extendedWaitUntil:
+ notVisible:
+ id: 'thunderid-field-username'
+ timeout: 20000
+
+ # The credentials step going away is necessary but not sufficient: a dropped connection
+ # replaces it with an error sheet, which satisfies the check above just as well as a
+ # successful submission does. Without this the retry treats the failure as a pass, exits,
+ # and the authenticated-state assertion below fails with no attempt left to save it.
+ #
+ # The pattern matches the element's whole text, so it needs the `.*` either side: the
+ # banner reads "[NETWORK_ERROR] Network request failed: ...", not "NETWORK_ERROR".
+ - assertNotVisible: '.*NETWORK_ERROR.*'
+
+# Authenticated state, asserted outside the retry on purpose. A submission the server accepted
+# that never reaches the authenticated state is a real failure, and it has to report as one.
+# Inside the retry it would instead re-enter the block, fail to find a form that is no longer on
+# screen, and surface as "element not found", which points at the wrong thing entirely.
+- extendedWaitUntil:
+ visible: 'Session active'
+ timeout: 60000
+
+# ...and back out again, so the flow leaves the app as it found it.
+- scrollUntilVisible:
+ element: 'Sign out'
+ direction: DOWN
+ timeout: 20000
+- tapOn: 'Sign out'
+- extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 20000
diff --git a/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/signup.yaml b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/signup.yaml
new file mode 100644
index 0000000..e5ca827
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/signup.yaml
@@ -0,0 +1,249 @@
+appId: dev.thunderid.Quickstart
+name: Sign up a new user, then sign in as them
+tags:
+ - auth
+env:
+ E2E_PASSWORD: TestPassword@123
+---
+- launchApp:
+ clearState: true
+- runFlow: subflows/ensure-signed-out.yaml
+
+# Registration has to claim a username that does not exist yet, so each run generates its own.
+# This leaves a user behind on the target server per run, which is fine for a disposable CI
+# instance; against a long-lived dev server, expect the accounts to accumulate.
+- evalScript: ${output.username = 'e2e_signup_' + Date.now()}
+
+# The registration step is server-rendered like the sign-in step, but its flow definition uses
+# different action refs, so the submit button id differs from signin.yaml.
+#
+# Entering a flow makes the first `POST /flow/execute` call, and a connection dropped there
+# (NSURLErrorDomain -1005) leaves the app on an error sheet with the step never rendered. That
+# is a transport failure rather than a product one, and a real user would simply try again, so
+# retry the entry. A step that genuinely never renders still fails, after the retries.
+- retry:
+ maxRetries: 2
+ commands:
+ # A second attempt means the previous one left the app on the error sheet, which carries
+ # no control to dismiss it and no way back to the landing screen. Restart before trying
+ # again. On the first attempt "Get started" is already on screen and this does nothing.
+ - runFlow:
+ when:
+ notVisible: 'Get started'
+ commands:
+ - launchApp:
+ clearState: true
+ - runFlow: subflows/ensure-signed-out.yaml
+ - tapOn: 'Get started'
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 25000
+
+# "Visible" fires the instant the field is on screen, which on a loaded CI runner can be before
+# the widget has actually finished settling (Flutter still completing its own build and layout
+# pass after the flow response arrives). Typing into a field that's mid-settle has been observed
+# to bind an empty string despite the keystrokes displaying correctly - the input lands, then
+# gets discarded when the widget finishes settling under it. Waiting for animations to end first
+# gives that settling a beat to finish before anything gets typed.
+- waitForAnimationToEnd:
+ timeout: 3000
+
+# A slow CI runner can take long enough filling and submitting this form that the server's
+# credentials-step challenge expires before submission, which silently resets the form instead
+# of registering - the email step then never appears. That is an expired challenge, not a
+# regression, so retry the fill-and-submit rather than fail outright.
+#
+# The retried view is not guaranteed to come back blank - a failed submission can just as easily
+# leave the previous attempt's text sitting in the field - so each retry erases before typing
+# rather than assuming an empty field.
+- retry:
+ maxRetries: 2
+ commands:
+ # A dropped connection strands the app on an error sheet with no control to dismiss it,
+ # so a retry has to restart rather than poke at a screen that is already gone. The form
+ # still being there is what says the attempt is recoverable in place, so key off that:
+ # on the first attempt, and on an expired-challenge retry, this does nothing.
+ - runFlow:
+ when:
+ notVisible:
+ id: 'thunderid-field-username'
+ commands:
+ - launchApp:
+ clearState: true
+ - runFlow: subflows/ensure-signed-out.yaml
+ # A restarted attempt is back on the landing screen rather than the form, so re-enter the
+ # flow. When the previous attempt got as far as the form this is already satisfied.
+ - runFlow:
+ when:
+ visible: 'Get started'
+ commands:
+ # Each attempt claims its own name: a connection dropped mid-submission can leave
+ # the registration applied server-side, and reusing the name would then fail as
+ # already taken rather than retrying cleanly.
+ - evalScript: ${output.username = 'e2e_signup_' + Date.now()}
+ - tapOn: 'Get started'
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 25000
+ - waitForAnimationToEnd:
+ timeout: 3000
+
+ - tapOn:
+ id: 'thunderid-field-username'
+ - eraseText: 50
+ - inputText: ${output.username}
+
+ # tapOn's own element-lookup timeout is much shorter than extendedWaitUntil's, and is not
+ # always enough on a loaded CI runner, so wait explicitly rather than tap blind.
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-password'
+ timeout: 20000
+ - tapOn:
+ id: 'thunderid-field-password'
+ - eraseText: 50
+ - inputText: ${E2E_PASSWORD}
+
+ - tapOn:
+ id: 'thunderid-action-action_credentials'
+
+ - runFlow: subflows/dismiss-save-password.yaml
+
+ # Registration is multi-step: the credentials step is followed by a step collecting the
+ # attributes the user schema requires (email here). Each step is a fresh server-rendered
+ # view with its own action ref. CI runners render this step noticeably slower than a local
+ # machine, so this uses the same 30s budget as the other post-submit waits below rather
+ # than 20s.
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-email'
+ timeout: 60000
+
+ # See the comment above the first waitForAnimationToEnd in this file - same settling race,
+ # same fix, for the first (and only) field on this freshly-rendered step.
+ - waitForAnimationToEnd:
+ timeout: 3000
+
+ - tapOn:
+ id: 'thunderid-field-email'
+ - inputText: ${output.username}@example.com
+
+ - tapOn:
+ id: 'thunderid-action-action_schema_attrs'
+
+ # Registration completes without issuing an assertion, so the user is created but NOT
+ # signed in and the app falls back to the landing screen. Signing in with the credentials
+ # just registered is what proves the account is actually usable.
+ #
+ # This submission is exposed to the same dropped connection (NSURLErrorDomain -1005) as
+ # the entry, and it strands the app on the same error sheet, so it sits inside this retry:
+ # a failed attempt restarts and registers again under a new name.
+ - extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 60000
+
+# Same transport exposure as the registration entry above.
+- retry:
+ maxRetries: 2
+ commands:
+ # A second attempt means the previous one left the app on the error sheet, which carries
+ # no control to dismiss it and no way back to the landing screen. Restart before trying
+ # again. On the first attempt "Sign in" is already on screen and this does nothing.
+ - runFlow:
+ when:
+ notVisible: 'Sign in'
+ commands:
+ - launchApp:
+ clearState: true
+ - runFlow: subflows/ensure-signed-out.yaml
+ - tapOn: 'Sign in'
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 25000
+
+# See the comment above the first waitForAnimationToEnd in this file - same settling race.
+- waitForAnimationToEnd:
+ timeout: 3000
+
+# A slow CI runner can take long enough filling and submitting this form that the server's
+# credentials-step challenge expires before submission, which silently resets the form instead
+# of authenticating - "Session active" then never appears. That is an expired challenge, not a
+# regression, so retry the fill-and-submit rather than fail outright.
+#
+# The retried view is not guaranteed to come back blank - a failed submission can just as easily
+# leave the previous attempt's text sitting in the field - so each retry erases before typing
+# rather than assuming an empty field.
+- retry:
+ maxRetries: 2
+ commands:
+ # A retry that follows a dropped connection has no form left to type into, only the error
+ # sheet. Restart and re-enter sign-in first. The account already exists by this point, so
+ # this reuses the same username rather than claiming a new one.
+ - runFlow:
+ when:
+ notVisible:
+ id: 'thunderid-field-username'
+ commands:
+ - launchApp:
+ clearState: true
+ - runFlow: subflows/ensure-signed-out.yaml
+ - tapOn: 'Sign in'
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 25000
+ - waitForAnimationToEnd:
+ timeout: 3000
+
+ - tapOn:
+ id: 'thunderid-field-username'
+ - eraseText: 50
+ - inputText: ${output.username}
+
+ # tapOn's own element-lookup timeout is much shorter than extendedWaitUntil's, and is not
+ # always enough on a loaded CI runner, so wait explicitly rather than tap blind.
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-password'
+ timeout: 20000
+ - tapOn:
+ id: 'thunderid-field-password'
+ - eraseText: 50
+ - inputText: ${E2E_PASSWORD}
+
+ - tapOn:
+ id: 'thunderid-action-action_001'
+
+ - runFlow: subflows/dismiss-save-password.yaml
+
+ # See signin.yaml: the retry tests whether the submission was accepted, which is the
+ # credentials step going away. The authenticated state is asserted outside the retry.
+ - extendedWaitUntil:
+ notVisible:
+ id: 'thunderid-field-username'
+ timeout: 20000
+
+ # The credentials step going away is necessary but not sufficient: a dropped connection
+ # replaces it with an error sheet, which satisfies the check above just as well as a
+ # successful submission does. Without this the retry treats the failure as a pass, exits,
+ # and the authenticated-state assertion below fails with no attempt left to save it.
+ #
+ # The pattern matches the element's whole text, so it needs the `.*` either side: the
+ # banner reads "[NETWORK_ERROR] Network request failed: ...", not "NETWORK_ERROR".
+ - assertNotVisible: '.*NETWORK_ERROR.*'
+
+- extendedWaitUntil:
+ visible: 'Session active'
+ timeout: 60000
+
+- scrollUntilVisible:
+ element: 'Sign out'
+ direction: DOWN
+ timeout: 20000
+- tapOn: 'Sign out'
+- extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 20000
diff --git a/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/change-password-to.yaml b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/change-password-to.yaml
new file mode 100644
index 0000000..f174e59
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/change-password-to.yaml
@@ -0,0 +1,53 @@
+appId: dev.thunderid.Quickstart
+---
+# Fills and submits the full-screen ChangeCredential form, then waits for a successful submit to
+# pop it back to the profile screen's credential row.
+- extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-newCredential'
+ timeout: 20000
+
+# See signin.yaml's equivalent comment: a field can be on screen before the page's own transition
+# (a fade, here) has actually finished settling, and typing into it mid-settle has been observed
+# to bind an empty string.
+- waitForAnimationToEnd:
+ timeout: 3000
+
+- tapOn:
+ id: 'thunderid-field-newCredential'
+- inputText: ${NEW_PASSWORD}
+- tapOn:
+ id: 'thunderid-field-confirmCredential'
+- inputText: ${NEW_PASSWORD}
+
+- tapOn:
+ id: 'thunderid-action-submitCredential'
+
+# Submitting two password fields can make iOS offer to save the new password, and that alert sits
+# over the app and swallows the assertion below, as it does after sign-in. The iOS SDK's suite
+# dismisses it at the same point.
+- runFlow: dismiss-save-password.yaml
+
+# A successful submission pops the full-screen form back to the profile screen, so the field
+# goes away rather than a new element appearing - that is what confirms the change went through.
+# The server hashes the new password before it answers, which has taken over 30 seconds on a
+# loaded CI runner, so allow well beyond that.
+#
+# A dropped connection (NSURLErrorDomain -1005) on a loaded CI runner fails the submission and
+# leaves the form open with an error and both fields still filled. Submitting the same password
+# again is safe even if the first request did reach the server, so tap Save again rather than
+# fail.
+- retry:
+ maxRetries: 2
+ commands:
+ - runFlow:
+ when:
+ visible: '.*error occurred while updating your password.*'
+ commands:
+ - tapOn:
+ id: 'thunderid-action-submitCredential'
+ - runFlow: dismiss-save-password.yaml
+ - extendedWaitUntil:
+ notVisible:
+ id: 'thunderid-field-newCredential'
+ timeout: 60000
diff --git a/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/dismiss-save-password.yaml b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/dismiss-save-password.yaml
new file mode 100644
index 0000000..bec22ce
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/dismiss-save-password.yaml
@@ -0,0 +1,23 @@
+appId: dev.thunderid.Quickstart
+---
+# iOS offers to store submitted credentials in the Keychain ("Save Password?") after a password
+# field is submitted. It is a system alert drawn over the app, so it swallows the taps and
+# assertions that follow a sign-in or sign-up. It is also not guaranteed to appear - whether iOS
+# prompts depends on prior AutoFill state - so it has to be dismissed conditionally rather than
+# unconditionally waited for.
+#
+# It does not always appear immediately - iOS can show it a beat after the field commits, more so
+# on a loaded CI runner - so a single check right after the submit tap can find nothing yet and
+# let the dialog appear afterward, right as the next assertion or tap runs. Polling a few short
+# windows instead of checking once covers that race without meaningfully slowing down the common
+# case where the dialog never appears at all.
+- repeat:
+ times: 4
+ commands:
+ - runFlow:
+ when:
+ visible: 'Save Password?'
+ commands:
+ - tapOn: 'Not Now'
+ - waitForAnimationToEnd:
+ timeout: 750
diff --git a/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/ensure-signed-out.yaml b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/ensure-signed-out.yaml
new file mode 100644
index 0000000..1890c1b
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/ensure-signed-out.yaml
@@ -0,0 +1,26 @@
+appId: dev.thunderid.Quickstart
+---
+# Bring the app to the unauthenticated landing screen, whatever state it starts in.
+#
+# The SDK persists tokens in the Keychain, which is outside the app container and therefore
+# survives both `clearState: true` and an app reinstall. A previous flow can consequently leave
+# the app authenticated, so an explicit sign-out is the only reliable way to get back to a known
+# starting point on a device that is not freshly created.
+- runFlow:
+ when:
+ visible: 'Session active'
+ commands:
+ - scrollUntilVisible:
+ element: 'Sign out'
+ direction: DOWN
+ timeout: 20000
+ - tapOn: 'Sign out'
+ - extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 20000
+
+# A bare assertVisible relies on Maestro's short default lookup timeout, which is not always
+# enough for the landing screen to render on a loaded CI emulator/simulator - wait explicitly.
+- extendedWaitUntil:
+ visible: 'Sign in'
+ timeout: 20000
diff --git a/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/open-change-password.yaml b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/open-change-password.yaml
new file mode 100644
index 0000000..dda07ea
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/open-change-password.yaml
@@ -0,0 +1,28 @@
+appId: dev.thunderid.Quickstart
+---
+# Opens the full-screen ChangeCredential form from the Security section's password row.
+#
+# Right after a previous change, the form is still popping back to this screen. A tap that lands
+# while that transition is settling can find the row on screen yet open nothing, which on a loaded
+# CI runner has left the flow waiting on a form that never appears. So wait for the screen to
+# settle, then tap again until the form is actually showing.
+- retry:
+ maxRetries: 2
+ commands:
+ - runFlow:
+ when:
+ notVisible:
+ id: 'thunderid-field-newCredential'
+ commands:
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-action-openCredential-password'
+ timeout: 20000
+ - waitForAnimationToEnd:
+ timeout: 3000
+ - tapOn:
+ id: 'thunderid-action-openCredential-password'
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-newCredential'
+ timeout: 15000
diff --git a/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/warm-up-trust.yaml b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/warm-up-trust.yaml
new file mode 100644
index 0000000..53c944f
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-flutter-e2e/flows/subflows/warm-up-trust.yaml
@@ -0,0 +1,18 @@
+appId: dev.thunderid.Quickstart
+---
+# Run once by run-e2e.sh before the suite, not as a test of its own.
+#
+# The first TLS trust evaluation on a freshly booted simulator makes trustd download and verify
+# Apple's PKI trust assets over the network, and until that finishes it answers no evaluation at
+# all. On a CI runner that can take minutes, long enough for every flow to time out waiting for
+# the sign-in form. Opening the form once, with a generous timeout, lets trustd finish before any
+# flow starts its clock.
+- launchApp:
+ clearState: true
+- runFlow: ensure-signed-out.yaml
+- tapOn: 'Sign in'
+- extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 600000
+- stopApp
diff --git a/tests/e2e/quickstarts/quickstart-flutter-e2e/run-e2e.sh b/tests/e2e/quickstarts/quickstart-flutter-e2e/run-e2e.sh
new file mode 100755
index 0000000..2a95cd3
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-flutter-e2e/run-e2e.sh
@@ -0,0 +1,85 @@
+#!/usr/bin/env bash
+# Copyright 2026 The ThunderID Authors
+# SPDX-License-Identifier: Apache-2.0
+#
+# Runs the quickstarts/quickstart-flutter E2E suite: starts a ThunderID server (or reuses one),
+# provisions the test application and user, builds the sample from this repository, installs it
+# on an iOS Simulator, and drives it with Maestro. Every stage is idempotent, so re-running is
+# the normal way to iterate.
+#
+# Usage:
+# ./run-e2e.sh Everything
+# ./run-e2e.sh --skip-server Server already running and provisioned
+# ./run-e2e.sh --skip-build Sample already installed on the device
+# ./run-e2e.sh flows/signin.yaml Run one flow instead of the whole suite
+#
+# Any other argument is passed through to Maestro.
+#
+# Environment:
+# SAMPLES_ROOT The samples checkout to build the sample from (default: this repository)
+# SIMULATOR_NAME Simulator to boot when none is booted (default iPhone 17, else any iPhone)
+# E2E_USERNAME Test user (default e2e_mobile_user)
+# E2E_PASSWORD Test user password (default TestPassword@123)
+# SERVER_URL, ADMIN_USERNAME, ADMIN_PASSWORD, THUNDERID_VERSION: see ../../shared/scripts/thunderid.sh
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+E2E_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
+THUNDERID="$E2E_ROOT/shared/scripts/thunderid.sh"
+SAMPLES_ROOT="${SAMPLES_ROOT:-$(cd "$E2E_ROOT/../.." && pwd)}"
+SAMPLE_DIR="$SAMPLES_ROOT/quickstarts/quickstart-flutter"
+CONFIG_FILE="$SAMPLE_DIR/thunderid-config/thunderid-config.yaml"
+
+export SERVER_URL="${SERVER_URL:-https://localhost:8090}"
+E2E_USER="${E2E_USERNAME:-e2e_mobile_user}"
+E2E_PASS="${E2E_PASSWORD:-TestPassword@123}"
+
+# Must match the `id` in $CONFIG_FILE.
+APP_ID="019e5b10-1001-7a2b-9c3d-4e5f60718293"
+
+do_server=true
+do_build=true
+maestro_args=()
+for arg in "$@"; do
+ case "$arg" in
+ --skip-server) do_server=false ;;
+ --skip-build) do_build=false ;;
+ -h | --help) sed -n '5,24p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
+ *) maestro_args+=("$arg") ;;
+ esac
+done
+
+# shellcheck source=../../shared/scripts/mobile.sh
+source "$E2E_ROOT/shared/scripts/mobile.sh"
+
+build_sample() {
+ echo "==> Configuring the sample"
+ # These flows run on iOS: the sample's iOS target carries an NSAllowsArbitraryLoads exemption, so
+ # it accepts the server's self-signed certificate, while its Android target has no equivalent.
+ cat >"$SAMPLE_DIR/.env" < Building and installing the sample"
+ (cd "$SAMPLE_DIR" && flutter pub get && flutter build ios --debug --simulator)
+ xcrun simctl install "$SIM_UDID" "$SAMPLE_DIR/build/ios/iphonesimulator/Runner.app"
+}
+
+# The first TLS trust evaluation on a freshly booted simulator makes trustd fetch Apple's PKI trust
+# assets, and it answers no evaluation until that finishes. Open the sign-in form once, untimed, so
+# no flow starts its clock while trustd is busy. A failed warm-up leaves the suite to report it.
+warm_up_trust() {
+ echo "==> Warming up certificate trust on the simulator"
+ (cd "$SCRIPT_DIR" && maestro --device "$SIM_UDID" test flows/subflows/warm-up-trust.yaml) ||
+ echo "WARNING: the trust warm-up did not reach the sign-in form; running the flows anyway." >&2
+}
+
+$do_server && provision_mobile_app "$CONFIG_FILE" "$APP_ID"
+resolve_simulator
+$do_build && build_sample
+warm_up_trust
+run_flows --device "$SIM_UDID"
diff --git a/tests/e2e/quickstarts/quickstart-ios-e2e/README.md b/tests/e2e/quickstarts/quickstart-ios-e2e/README.md
new file mode 100644
index 0000000..9289b45
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-ios-e2e/README.md
@@ -0,0 +1,46 @@
+# ThunderID iOS Quickstart E2E
+
+Maestro flows that drive [`quickstarts/quickstart-ios`](../../../../quickstarts/quickstart-ios) through real authentication against a real ThunderID server on an iOS Simulator. The sample is built from this repository with the SDK release it pins.
+
+| Flow | What it checks |
+| ------------------------------ | ----------------------------------------------------------------- |
+| `flows/signin.yaml` | Sign in through the server-driven credentials step, then sign out |
+| `flows/signup.yaml` | Register a new user, then sign in as them |
+| `flows/change-credential.yaml` | Change the password from Manage Account, then change it back |
+
+`flows/subflows/` holds the building blocks the flows share. The flows are the ones the SDK repository's suite ran, unchanged: each platform's UI differs enough (system dialogs, field ids, scrolling) that the three mobile suites keep their own flows.
+
+## Prerequisites
+
+Xcode (with an iPhone simulator), [Maestro](https://maestro.mobile.dev/getting-started/installing-maestro), `curl`, `jq`, `openssl`, `unzip`.
+
+## Run
+
+```bash
+# Everything: start or reuse a server, provision it, build and install the sample, run the flows
+./run-e2e.sh
+
+# Iterate faster once the server is provisioned and the sample installed
+./run-e2e.sh --skip-server --skip-build
+
+# One flow
+./run-e2e.sh flows/signin.yaml
+```
+
+`run-e2e.sh` uses [`shared/scripts/thunderid.sh`](../../shared/scripts/thunderid.sh) to start the server (or reuse one already serving on `SERVER_URL`), imports the sample's own `thunderid-config/thunderid-config.yaml`, creates the test user `e2e_mobile_user` / `TestPassword@123`, then writes `Sources/Config.plist` into the sample, builds it with `xcodebuild`, and installs it on the booted simulator (booting one if none is). Maestro writes a JUnit report to `report.xml`. Set `SAMPLES_ROOT` to build the sample from another samples checkout. The script writes the sample's local config file (git-ignored in the sample), so point `SAMPLES_ROOT` at a copy if you keep your own config there.
+
+Windows: the SDK repository's `run-e2e.ps1` is not ported; run the suite from macOS or Linux.
+
+These suites do not run in CI yet. Adding them, on macOS runners with a simulator and on Linux with an Android emulator, is a follow-up.
+
+## Things worth knowing
+
+**The application must be `type: mobile` with `attestation.devMode: true`.** A mobile application normally proves its binary identity through platform attestation before it can start a flow directly, and `/flow/execute` rejects it with `FES-1016` otherwise. Neither Apple App Attest nor Play Integrity works on an emulated device. `devMode` is test-only and must never be enabled on a real tenant.
+
+**`POST /import` drops the `attestation` block.** It reports success and stores `attestation: null`, so `run-e2e.sh` re-applies it over `PUT /applications/{id}`. Once the import keeps it, that step can go.
+
+**Sign-up does not sign the user in.** The registration flow completes without an assertion, so `signup.yaml` signs in afterwards with the new credentials, which also proves the account works. Each run leaves an `e2e_signup_` user on the server.
+
+**`change-credential.yaml` really changes the test user's password**, to a temporary value and back. If a run fails in between, re-running `change-credential.yaml` changes it back.
+
+**Tokens survive `clearState`.** They live in the Keychain, outside the app container, so every flow starts with `subflows/ensure-signed-out.yaml`.
diff --git a/tests/e2e/quickstarts/quickstart-ios-e2e/flows/change-credential.yaml b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/change-credential.yaml
new file mode 100644
index 0000000..5b381ea
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/change-credential.yaml
@@ -0,0 +1,52 @@
+appId: dev.thunderid.Quickstart
+name: Change password from Manage Account
+tags:
+ - account
+env:
+ E2E_USERNAME: e2e_mobile_user
+ E2E_PASSWORD: TestPassword@123
+ # This flow actually changes E2E_PASSWORD on the shared E2E user via the real backend (the
+ # self-service credential write path has no "current value" concept to gate this behind), so it
+ # changes to this value and back to E2E_PASSWORD before finishing. If this flow fails between
+ # those two steps, the E2E user is left on this password until the next run fixes it, not
+ # E2E_PASSWORD - see the closing comment for how a re-run recovers on its own.
+ E2E_TEMP_PASSWORD: TempPassword@456
+---
+- launchApp:
+ clearState: true
+- runFlow: subflows/ensure-signed-out.yaml
+
+- runFlow: subflows/sign-in.yaml
+
+- scrollUntilVisible:
+ element: 'Manage Account'
+ direction: DOWN
+ timeout: 20000
+- tapOn: 'Manage Account'
+
+# UserProfile's own field rows render above it, so the row can start off-screen on a small device.
+- scrollUntilVisible:
+ element: 'Change Password'
+ direction: DOWN
+ timeout: 20000
+
+# Change away from E2E_PASSWORD, then immediately back, so the E2E user's credential is unchanged
+# once this flow finishes, matching signin.yaml's "leaves the app as it found it" convention.
+- runFlow:
+ file: subflows/change-password-to.yaml
+ env:
+ NEW_PASSWORD: ${E2E_TEMP_PASSWORD}
+- runFlow:
+ file: subflows/change-password-to.yaml
+ env:
+ NEW_PASSWORD: ${E2E_PASSWORD}
+
+- tapOn: 'Home'
+- scrollUntilVisible:
+ element: 'Sign out'
+ direction: DOWN
+ timeout: 20000
+- tapOn: 'Sign out'
+- extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 20000
diff --git a/tests/e2e/quickstarts/quickstart-ios-e2e/flows/config.yaml b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/config.yaml
new file mode 100644
index 0000000..a6bf438
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/config.yaml
@@ -0,0 +1,6 @@
+# Maestro workspace configuration for the iOS Quickstart E2E suite.
+#
+# Only the top-level flows are test entry points. Without this, `maestro test .maestro/` would
+# also recurse into subflows/ and run the shared building blocks as if they were tests.
+flows:
+ - '*.yaml'
diff --git a/tests/e2e/quickstarts/quickstart-ios-e2e/flows/signin.yaml b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/signin.yaml
new file mode 100644
index 0000000..7aacece
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/signin.yaml
@@ -0,0 +1,23 @@
+appId: dev.thunderid.Quickstart
+name: Sign in and sign out
+tags:
+ - auth
+env:
+ E2E_USERNAME: e2e_mobile_user
+ E2E_PASSWORD: TestPassword@123
+---
+- launchApp:
+ clearState: true
+- runFlow: subflows/ensure-signed-out.yaml
+
+- runFlow: subflows/sign-in.yaml
+
+# ...and back out again, so the flow leaves the app as it found it.
+- scrollUntilVisible:
+ element: 'Sign out'
+ direction: DOWN
+ timeout: 20000
+- tapOn: 'Sign out'
+- extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 20000
diff --git a/tests/e2e/quickstarts/quickstart-ios-e2e/flows/signup.yaml b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/signup.yaml
new file mode 100644
index 0000000..41f070a
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/signup.yaml
@@ -0,0 +1,149 @@
+appId: dev.thunderid.Quickstart
+name: Sign up a new user, then sign in as them
+tags:
+ - auth
+env:
+ E2E_PASSWORD: TestPassword@123
+---
+- launchApp:
+ clearState: true
+- runFlow: subflows/ensure-signed-out.yaml
+
+# Registration has to claim a username that does not exist yet, so each run generates its own.
+# This leaves a user behind on the target server per run, which is fine for a disposable CI
+# instance; against a long-lived dev server, expect the accounts to accumulate.
+- evalScript: ${output.username = 'e2e_signup_' + Date.now()}
+
+- tapOn: 'Get started'
+
+# The registration step is server-rendered like the sign-in step, but its flow definition uses
+# different action refs, so the submit button id differs from signin.yaml.
+- extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 20000
+
+# "Visible" fires the instant the field is on screen, which on a loaded CI runner can be before
+# the view has actually finished settling (SwiftUI still completing its own layout/render pass
+# after the flow response arrives). Typing into a field that's mid-settle has been observed to
+# bind an empty string despite the keystrokes displaying correctly - the input lands, then gets
+# discarded when the view finishes settling under it. Waiting for animations to end first gives
+# that settling a beat to finish before anything gets typed.
+- waitForAnimationToEnd:
+ timeout: 3000
+
+# A slow CI runner can take long enough filling and submitting this form that the server's
+# credentials-step challenge expires before submission, which silently resets the form instead
+# of registering - the email step then never appears. That is an expired challenge, not a
+# regression, so retry the fill-and-submit rather than fail outright.
+#
+# The retried view is not guaranteed to come back blank - a failed submission can just as easily
+# leave the previous attempt's text sitting in the field - so each retry erases before typing
+# rather than assuming an empty field.
+- retry:
+ maxRetries: 2
+ commands:
+ - tapOn:
+ id: 'thunderid-field-username'
+ - eraseText: 50
+ - inputText: ${output.username}
+
+ # tapOn's own element-lookup timeout is much shorter than extendedWaitUntil's, and is not
+ # always enough on a loaded CI runner, so wait explicitly rather than tap blind.
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-password'
+ timeout: 20000
+ - tapOn:
+ id: 'thunderid-field-password'
+ - eraseText: 50
+ - inputText: ${E2E_PASSWORD}
+
+ - tapOn:
+ id: 'thunderid-action-action_credentials'
+
+ - runFlow: subflows/dismiss-save-password.yaml
+
+ # Registration is multi-step: the credentials step is followed by a step collecting the
+ # attributes the user schema requires (email here). Each step is a fresh server-rendered
+ # view with its own action ref. CI runners render this step noticeably slower than a local
+ # Mac, so this uses the same 30s budget as the other post-submit waits below rather than
+ # 20s.
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-email'
+ timeout: 30000
+
+# See the comment above the first waitForAnimationToEnd in this file - same settling race,
+# same fix, for the first (and only) field on this freshly-rendered step.
+- waitForAnimationToEnd:
+ timeout: 3000
+
+- tapOn:
+ id: 'thunderid-field-email'
+- inputText: ${output.username}@example.com
+
+- tapOn:
+ id: 'thunderid-action-action_schema_attrs'
+
+# Registration completes without issuing an assertion, so the user is created but NOT signed in
+# and the app falls back to the landing screen. Signing in with the credentials just registered
+# is what proves the account is actually usable.
+- extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 30000
+
+- tapOn: 'Sign in'
+- extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 20000
+
+# See the comment above the first waitForAnimationToEnd in this file - same settling race.
+- waitForAnimationToEnd:
+ timeout: 3000
+
+# A slow CI runner can take long enough filling and submitting this form that the server's
+# credentials-step challenge expires before submission, which silently resets the form instead
+# of authenticating - "Session active" then never appears. That is an expired challenge, not a
+# regression, so retry the fill-and-submit rather than fail outright.
+#
+# The retried view is not guaranteed to come back blank - a failed submission can just as easily
+# leave the previous attempt's text sitting in the field - so each retry erases before typing
+# rather than assuming an empty field.
+- retry:
+ maxRetries: 2
+ commands:
+ - tapOn:
+ id: 'thunderid-field-username'
+ - eraseText: 50
+ - inputText: ${output.username}
+
+ # tapOn's own element-lookup timeout is much shorter than extendedWaitUntil's, and is not
+ # always enough on a loaded CI runner, so wait explicitly rather than tap blind.
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-password'
+ timeout: 20000
+ - tapOn:
+ id: 'thunderid-field-password'
+ - eraseText: 50
+ - inputText: ${E2E_PASSWORD}
+
+ - tapOn:
+ id: 'thunderid-action-action_001'
+
+ - runFlow: subflows/dismiss-save-password.yaml
+
+ - extendedWaitUntil:
+ visible: 'Session active'
+ timeout: 30000
+
+- scrollUntilVisible:
+ element: 'Sign out'
+ direction: DOWN
+ timeout: 20000
+- tapOn: 'Sign out'
+- extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 20000
diff --git a/tests/e2e/quickstarts/quickstart-ios-e2e/flows/subflows/change-password-to.yaml b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/subflows/change-password-to.yaml
new file mode 100644
index 0000000..e1c2b16
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/subflows/change-password-to.yaml
@@ -0,0 +1,27 @@
+appId: dev.thunderid.Quickstart
+---
+# Opens the ChangeCredential sheet from the Manage Account screen's "Change Password" row, submits
+# NEW_PASSWORD as both the new value and its confirmation, and waits for the sheet to dismiss
+# (ChangeCredential's own success behavior - there is no separate on-screen confirmation).
+- tapOn: 'Change Password'
+- extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-newCredential'
+ timeout: 20000
+- waitForAnimationToEnd:
+ timeout: 3000
+
+- tapOn:
+ id: 'thunderid-field-newCredential'
+- inputText: ${NEW_PASSWORD}
+- tapOn:
+ id: 'thunderid-field-confirmCredential'
+- inputText: ${NEW_PASSWORD}
+
+- tapOn: 'Change'
+- runFlow: dismiss-save-password.yaml
+
+# The sheet auto-dismisses on success, so the row's own heading becomes visible again.
+- extendedWaitUntil:
+ visible: 'Change Password'
+ timeout: 20000
diff --git a/tests/e2e/quickstarts/quickstart-ios-e2e/flows/subflows/dismiss-save-password.yaml b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/subflows/dismiss-save-password.yaml
new file mode 100644
index 0000000..bec22ce
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/subflows/dismiss-save-password.yaml
@@ -0,0 +1,23 @@
+appId: dev.thunderid.Quickstart
+---
+# iOS offers to store submitted credentials in the Keychain ("Save Password?") after a password
+# field is submitted. It is a system alert drawn over the app, so it swallows the taps and
+# assertions that follow a sign-in or sign-up. It is also not guaranteed to appear - whether iOS
+# prompts depends on prior AutoFill state - so it has to be dismissed conditionally rather than
+# unconditionally waited for.
+#
+# It does not always appear immediately - iOS can show it a beat after the field commits, more so
+# on a loaded CI runner - so a single check right after the submit tap can find nothing yet and
+# let the dialog appear afterward, right as the next assertion or tap runs. Polling a few short
+# windows instead of checking once covers that race without meaningfully slowing down the common
+# case where the dialog never appears at all.
+- repeat:
+ times: 4
+ commands:
+ - runFlow:
+ when:
+ visible: 'Save Password?'
+ commands:
+ - tapOn: 'Not Now'
+ - waitForAnimationToEnd:
+ timeout: 750
diff --git a/tests/e2e/quickstarts/quickstart-ios-e2e/flows/subflows/ensure-signed-out.yaml b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/subflows/ensure-signed-out.yaml
new file mode 100644
index 0000000..61ae4dd
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/subflows/ensure-signed-out.yaml
@@ -0,0 +1,26 @@
+appId: dev.thunderid.Quickstart
+---
+# Bring the app to the unauthenticated landing screen, whatever state it starts in.
+#
+# The SDK persists tokens in the Keychain, which is outside the app container and therefore
+# survives both `clearState: true` and an app reinstall. A previous flow can consequently leave
+# the app authenticated, so an explicit sign-out is the only reliable way to get back to a known
+# starting point on a device that is not freshly created.
+- runFlow:
+ when:
+ visible: 'Session active'
+ commands:
+ - scrollUntilVisible:
+ element: 'Sign out'
+ direction: DOWN
+ timeout: 20000
+ - tapOn: 'Sign out'
+ - extendedWaitUntil:
+ visible: 'Get started'
+ timeout: 20000
+
+# A bare assertVisible relies on Maestro's short default lookup timeout, which is not always
+# enough for the landing screen to render on a loaded CI simulator - wait explicitly.
+- extendedWaitUntil:
+ visible: 'Sign in'
+ timeout: 20000
diff --git a/tests/e2e/quickstarts/quickstart-ios-e2e/flows/subflows/sign-in.yaml b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/subflows/sign-in.yaml
new file mode 100644
index 0000000..c291b42
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-ios-e2e/flows/subflows/sign-in.yaml
@@ -0,0 +1,61 @@
+appId: dev.thunderid.Quickstart
+---
+# Signs in with E2E_USERNAME/E2E_PASSWORD via the server-driven credentials step and waits for the
+# authenticated "Session active" state. Shared by every flow that needs to start from a signed-in
+# state; the caller is expected to have defined those two env vars itself.
+
+- tapOn: 'Sign in'
+
+# The credentials step is rendered from the flow definition the server returns, not from static
+# native views. The SDK tags each input with the field's identifier and each button with the
+# action's ref, so these ids track the server's flow response.
+- extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-username'
+ timeout: 20000
+
+# "Visible" fires the instant the field is on screen, which on a loaded CI runner can be before
+# the view has actually finished settling (SwiftUI still completing its own layout/render pass
+# after the flow response arrives). Typing into a field that's mid-settle has been observed to
+# bind an empty string despite the keystrokes displaying correctly - the input lands, then gets
+# discarded when the view finishes settling under it. Waiting for animations to end first gives
+# that settling a beat to finish before anything gets typed.
+- waitForAnimationToEnd:
+ timeout: 3000
+
+# A slow CI runner can take long enough filling and submitting this form that the server's
+# credentials-step challenge expires before submission, which silently resets the form instead
+# of authenticating - "Session active" then never appears. That is an expired challenge, not a
+# regression, so retry the fill-and-submit rather than fail outright.
+#
+# The retried view is not guaranteed to come back blank - a failed submission can just as easily
+# leave the previous attempt's text sitting in the field - so each retry erases before typing
+# rather than assuming an empty field.
+- retry:
+ maxRetries: 2
+ commands:
+ - tapOn:
+ id: 'thunderid-field-username'
+ - eraseText: 50
+ - inputText: ${E2E_USERNAME}
+
+ # tapOn's own element-lookup timeout is much shorter than extendedWaitUntil's, and is not
+ # always enough on a loaded CI runner, so wait explicitly rather than tap blind.
+ - extendedWaitUntil:
+ visible:
+ id: 'thunderid-field-password'
+ timeout: 20000
+ - tapOn:
+ id: 'thunderid-field-password'
+ - eraseText: 50
+ - inputText: ${E2E_PASSWORD}
+
+ - tapOn:
+ id: 'thunderid-action-action_001'
+
+ - runFlow: dismiss-save-password.yaml
+
+ # Authenticated state.
+ - extendedWaitUntil:
+ visible: 'Session active'
+ timeout: 30000
diff --git a/tests/e2e/quickstarts/quickstart-ios-e2e/run-e2e.sh b/tests/e2e/quickstarts/quickstart-ios-e2e/run-e2e.sh
new file mode 100755
index 0000000..13a0ec3
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-ios-e2e/run-e2e.sh
@@ -0,0 +1,87 @@
+#!/usr/bin/env bash
+# Copyright 2026 The ThunderID Authors
+# SPDX-License-Identifier: Apache-2.0
+#
+# Runs the quickstarts/quickstart-ios E2E suite: starts a ThunderID server (or reuses one),
+# provisions the test application and user, builds the sample from this repository, installs it
+# on an iOS Simulator, and drives it with Maestro. Every stage is idempotent, so re-running is
+# the normal way to iterate.
+#
+# Usage:
+# ./run-e2e.sh Everything
+# ./run-e2e.sh --skip-server Server already running and provisioned
+# ./run-e2e.sh --skip-build Sample already installed on the simulator
+# ./run-e2e.sh flows/signin.yaml Run one flow instead of the whole suite
+#
+# Any other argument is passed through to Maestro.
+#
+# Environment:
+# SAMPLES_ROOT The samples checkout to build the sample from (default: this repository)
+# SIMULATOR_NAME Simulator to boot when none is booted (default iPhone 17, else any iPhone)
+# E2E_USERNAME Test user (default e2e_mobile_user)
+# E2E_PASSWORD Test user password (default TestPassword@123)
+# SERVER_URL, ADMIN_USERNAME, ADMIN_PASSWORD, THUNDERID_VERSION: see ../../shared/scripts/thunderid.sh
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+E2E_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
+THUNDERID="$E2E_ROOT/shared/scripts/thunderid.sh"
+SAMPLES_ROOT="${SAMPLES_ROOT:-$(cd "$E2E_ROOT/../.." && pwd)}"
+SAMPLE_DIR="$SAMPLES_ROOT/quickstarts/quickstart-ios"
+CONFIG_FILE="$SAMPLE_DIR/thunderid-config/thunderid-config.yaml"
+
+export SERVER_URL="${SERVER_URL:-https://localhost:8090}"
+E2E_USER="${E2E_USERNAME:-e2e_mobile_user}"
+E2E_PASS="${E2E_PASSWORD:-TestPassword@123}"
+
+# Must match the `id` in $CONFIG_FILE.
+APP_ID="019e5b10-1001-7a2b-9c3d-4e5f60718293"
+
+do_server=true
+do_build=true
+maestro_args=()
+for arg in "$@"; do
+ case "$arg" in
+ --skip-server) do_server=false ;;
+ --skip-build) do_build=false ;;
+ -h | --help) sed -n '5,24p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
+ *) maestro_args+=("$arg") ;;
+ esac
+done
+
+# shellcheck source=../../shared/scripts/mobile.sh
+source "$E2E_ROOT/shared/scripts/mobile.sh"
+
+build_sample() {
+ echo "==> Configuring the sample"
+ # The sample reaches the self-signed local server because its Info.plist carries an
+ # NSAllowsArbitraryLoads exemption.
+ cat >"$SAMPLE_DIR/Sources/Config.plist" <
+
+
+
+ THUNDERID_BASE_URL
+ $SERVER_URL
+ THUNDERID_APPLICATION_ID
+ $APP_ID
+
+
+PLIST
+
+ echo "==> Building and installing the sample"
+ (cd "$SAMPLE_DIR" && xcodebuild \
+ -project Quickstart.xcodeproj \
+ -scheme Quickstart \
+ -configuration Debug \
+ -destination "platform=iOS Simulator,id=$SIM_UDID" \
+ -derivedDataPath .build/e2e-derived \
+ build)
+ xcrun simctl install "$SIM_UDID" "$SAMPLE_DIR/.build/e2e-derived/Build/Products/Debug-iphonesimulator/Quickstart.app"
+}
+
+$do_server && provision_mobile_app "$CONFIG_FILE" "$APP_ID"
+resolve_simulator
+$do_build && build_sample
+run_flows --device "$SIM_UDID"
diff --git a/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/README.md b/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/README.md
new file mode 100644
index 0000000..8791a3e
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/README.md
@@ -0,0 +1,21 @@
+# ThunderID Next.js B2B Quickstart E2E
+
+Playwright suite for [`quickstarts/quickstart-nextjs-b2b`](../../../../quickstarts/quickstart-nextjs-b2b). It starts the sample from its own sources with its published SDK, signs in against a real ThunderID server, and checks:
+
+- Registering a company signs its first admin in to it, with the company and the `Next.js B2B Admin` role in the token
+- An account shared into two companies switches between them on the server, with the device secret
+- Sign-out
+
+## Run
+
+Start a ThunderID server first (see the [E2E README](../../README.md)), then, from `tests/e2e`:
+
+```bash
+npm ci
+npx playwright install chromium
+npm test -w quickstarts/quickstart-nextjs-b2b-e2e
+```
+
+Playwright installs the sample with `npm ci` when it has no `node_modules`, and serves it on port 3000 with the sample's own OAuth2 client `NEXTJS_B2B_QUICKSTART`. The global setup imports that client and creates the test users. Set `SAMPLES_ROOT` to run against another samples checkout, such as a `git archive` export.
+
+The global setup imports the sample's own `thunderid-config/thunderid-config.yaml`, which needs a ThunderID server newer than 1.1.1. Its redirect URIs fix port 3000, shared with `quickstart-express` and `wayfinder-enterprise-nextjs`. The import sets the server-wide `defaultResourceServer`, which gives the token its `org` scope; with `E2E_SKIP_SERVER_CONFIGS=true` the suite skips that check. Every run registers new companies, which stay on the server.
diff --git a/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/ci-skip b/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/ci-skip
new file mode 100644
index 0000000..7a45cea
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/ci-skip
@@ -0,0 +1 @@
+Needs a ThunderID server built from main: the latest release rejects this sample's configuration (organization unit permissions and flows). Remove this file once a release supports it.
diff --git a/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/fixtures.ts b/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/fixtures.ts
new file mode 100644
index 0000000..0a33a37
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/fixtures.ts
@@ -0,0 +1,13 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {test as base} from '@playwright/test';
+import {B2BQuickstartPage} from '../../shared/pages/b2b-quickstart.page.ts';
+
+export const test = base.extend<{b2bPage: B2BQuickstartPage}>({
+ b2bPage: async ({page}, use) => {
+ await use(new B2BQuickstartPage(page));
+ },
+});
+
+export {expect} from '@playwright/test';
diff --git a/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/package.json b/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/package.json
new file mode 100644
index 0000000..dcb4029
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@thunderid/quickstart-nextjs-b2b-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "E2E suite of quickstarts/quickstart-nextjs-b2b",
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+}
diff --git a/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/playwright.config.ts b/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/playwright.config.ts
new file mode 100644
index 0000000..29dcd0c
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/playwright.config.ts
@@ -0,0 +1,31 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {randomBytes} from 'node:crypto';
+import {defineSampleConfig, sampleWebServer} from '../../shared/playwright.ts';
+
+// The sample's own thunderid-config (imported by the global setup) registers the client with
+// redirect URIs on http://localhost:3000, which fixes the port. The client secret matches the one
+// shared/apps.ts imports for NEXTJS_B2B_CLIENT_SECRET.
+const appUrl = 'http://localhost:3000';
+
+const config = defineSampleConfig({
+ app: 'NEXTJS_B2B',
+ webServer: sampleWebServer('NEXTJS_B2B', {
+ command: 'npm run dev -- -p 3000',
+ env: {
+ NEXT_PUBLIC_THUNDERID_AFTER_SIGN_IN_URL: appUrl,
+ NEXT_PUBLIC_THUNDERID_AFTER_SIGN_OUT_URL: appUrl,
+ NEXT_PUBLIC_THUNDERID_BASE_URL: process.env.SERVER_URL!,
+ NEXT_PUBLIC_THUNDERID_CLIENT_ID: 'NEXTJS_B2B_QUICKSTART',
+ NEXT_PUBLIC_THUNDERID_SCOPES: 'openid profile email roles ou org device_sso',
+ NEXT_PUBLIC_THUNDERID_SIGN_IN_FLOW_ID: '019f0b20-0000-7000-8000-000000000021',
+ NODE_TLS_REJECT_UNAUTHORIZED: '0',
+ THUNDERID_CLIENT_SECRET: 'e2e-nextjs-b2b-secret',
+ THUNDERID_SESSION_SECRET: randomBytes(32).toString('base64'),
+ },
+ url: appUrl,
+ }),
+});
+
+export default config;
diff --git a/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/tests/companies.spec.ts b/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/tests/companies.spec.ts
new file mode 100644
index 0000000..47e05cc
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nextjs-b2b-e2e/tests/companies.spec.ts
@@ -0,0 +1,77 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * quickstarts/quickstart-nextjs-b2b - company sign-up, the organization and roles in the token, and
+ * switching between companies. Every run registers new companies, since handles and usernames are
+ * unique; they stay on the server. The switch runs on the app's server, which exchanges the
+ * session's device secret for the other company's tokens.
+ */
+
+import {SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {newCompany} from '../../../shared/pages/b2b-gate.page.ts';
+import {
+ createChildOrganizationUnit,
+ createDefaultOuUser,
+ shareUserWithAllChildUnits,
+} from '../../../shared/utils/organization-units/index.ts';
+import {expect, test} from '../fixtures.ts';
+
+const appUrl = sampleAppUrl(SampleApps.NEXTJS_B2B);
+const USER_TYPE = 'nextjs-b2b-user';
+
+test.describe('quickstarts/quickstart-nextjs-b2b - Companies', () => {
+ test('TC001: registering a company signs its first admin in to it', async ({b2bPage}) => {
+ const company = newCompany('nextjs-b2b');
+ await b2bPage.goto(appUrl);
+ await b2bPage.clickSignInButton();
+ await b2bPage.registerCompany(company, 'My account belongs to this company');
+
+ await b2bPage.verifySignedInTo(company.name);
+ expect(await b2bPage.claim('ouHandle')).toBe(company.handle);
+ expect(await b2bPage.claim('ouName')).toBe(company.name);
+ expect(await b2bPage.claim('roles')).toContain('Next.js B2B Admin');
+ // The app names no resource, so `org` comes from the defaultResourceServer server config the
+ // sample's import sets, which E2E_SKIP_SERVER_CONFIGS leaves out.
+ if (process.env.E2E_SKIP_SERVER_CONFIGS !== 'true') {
+ expect((await b2bPage.claim('scope')).split(' ')).toContain('org');
+ }
+ });
+
+ test('TC002: an account in two companies switches between them without signing in again', async ({b2bPage}) => {
+ // The Console's "Affiliations" setup from the sample's README, through the API: two companies
+ // and an account in the Default organization unit shared into every company beneath it.
+ const alpha = newCompany('nextjs-b2b-alpha');
+ const beta = newCompany('nextjs-b2b-beta');
+ await createChildOrganizationUnit(alpha.handle, alpha.name);
+ await createChildOrganizationUnit(beta.handle, beta.name);
+ const user = await createDefaultOuUser(USER_TYPE, {
+ email: alpha.email,
+ password: alpha.password,
+ username: alpha.username,
+ });
+ await shareUserWithAllChildUnits(user.id);
+
+ await b2bPage.goto(appUrl);
+ await b2bPage.clickSignInButton();
+ await b2bPage.login(alpha.username, alpha.password);
+ await b2bPage.chooseCompany(alpha.handle);
+ await b2bPage.verifySignedInTo(alpha.name);
+ expect(await b2bPage.claim('ouHandle')).toBe(alpha.handle);
+
+ await b2bPage.switchTo(alpha.name, beta.name);
+ await b2bPage.verifySignedInTo(beta.name);
+ expect(await b2bPage.claim('ouHandle')).toBe(beta.handle);
+ });
+
+ test('TC003: signs out after registering a company', async ({b2bPage}) => {
+ const company = newCompany('nextjs-b2b');
+ await b2bPage.goto(appUrl);
+ await b2bPage.clickSignInButton();
+ await b2bPage.registerCompany(company, 'My account belongs to this company');
+ await b2bPage.verifySignedInTo(company.name);
+
+ await b2bPage.logout();
+ await b2bPage.verifyLoggedOut();
+ });
+});
diff --git a/tests/e2e/quickstarts/quickstart-nextjs-e2e/README.md b/tests/e2e/quickstarts/quickstart-nextjs-e2e/README.md
new file mode 100644
index 0000000..ebff2de
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nextjs-e2e/README.md
@@ -0,0 +1,20 @@
+# ThunderID Next.js Quickstart E2E
+
+Playwright suite for [`quickstarts/quickstart-nextjs`](../../../../quickstarts/quickstart-nextjs). It starts the sample from its own sources with its published SDK, signs in against a real ThunderID server, and checks:
+
+- Sign in and sign out through the redirect flow, which the suite turns on by setting a client ID (the sample defaults to its native flow)
+- The token debug page shows a valid access token
+- Profile edits on the Account page are saved
+- A password change on the Security tab takes effect and can be reverted
+
+## Run
+
+Start a ThunderID server first (see the [E2E README](../../README.md)), then, from `tests/e2e`:
+
+```bash
+npm ci
+npx playwright install chromium
+npm test -w quickstarts/quickstart-nextjs-e2e
+```
+
+Playwright installs the sample with `npm ci` when it has no `node_modules`, and serves it on port 3001 with the OAuth2 client `JS_SDK_E2E_NEXTJS`. The global setup imports that client and creates the test users. Set `SAMPLES_ROOT` to run against another samples checkout, such as a `git archive` export.
diff --git a/tests/e2e/quickstarts/quickstart-nextjs-e2e/fixtures.ts b/tests/e2e/quickstarts/quickstart-nextjs-e2e/fixtures.ts
new file mode 100644
index 0000000..48fddf2
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nextjs-e2e/fixtures.ts
@@ -0,0 +1,13 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {test as base} from '@playwright/test';
+import {ThunderIDAccountPageSamplePage} from '../../shared/pages/thunderid-web-sample.page.ts';
+
+export const test = base.extend<{nextjsQuickstartPage: ThunderIDAccountPageSamplePage}>({
+ nextjsQuickstartPage: async ({page}, use) => {
+ await use(new ThunderIDAccountPageSamplePage(page));
+ },
+});
+
+export {expect} from '@playwright/test';
diff --git a/tests/e2e/quickstarts/quickstart-nextjs-e2e/package.json b/tests/e2e/quickstarts/quickstart-nextjs-e2e/package.json
new file mode 100644
index 0000000..9b1b0f2
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nextjs-e2e/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@thunderid/quickstart-nextjs-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "E2E suite of quickstarts/quickstart-nextjs, in redirect mode",
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+}
diff --git a/tests/e2e/quickstarts/quickstart-nextjs-e2e/playwright.config.ts b/tests/e2e/quickstarts/quickstart-nextjs-e2e/playwright.config.ts
new file mode 100644
index 0000000..7314fd8
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nextjs-e2e/playwright.config.ts
@@ -0,0 +1,27 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {randomBytes} from 'node:crypto';
+import {sharedClientVariable} from '../../shared/apps.ts';
+import {defineSampleConfig, sampleWebServer} from '../../shared/playwright.ts';
+
+// A client ID puts the sample in redirect mode (see its app/layout.tsx), so its native-flow
+// variables (application ID, sign-in and sign-up URLs, flow secret) stay unset.
+const sessionSecret = randomBytes(32).toString('base64');
+
+const config = defineSampleConfig({
+ app: 'NEXTJS',
+ webServer: sampleWebServer('NEXTJS', {
+ command: 'npm run dev -- -p 3001',
+ env: {
+ NEXT_PUBLIC_THUNDERID_BASE_URL: process.env.SERVER_URL!,
+ NEXT_PUBLIC_THUNDERID_CLIENT_ID: sharedClientVariable('NEXTJS_CLIENT_ID'),
+ NODE_TLS_REJECT_UNAUTHORIZED: '0',
+ THUNDERID_CLIENT_SECRET: sharedClientVariable('NEXTJS_CLIENT_SECRET'),
+ THUNDERID_SECRET: sessionSecret,
+ THUNDERID_SESSION_SECRET: sessionSecret,
+ },
+ }),
+});
+
+export default config;
diff --git a/tests/e2e/quickstarts/quickstart-nextjs-e2e/tests/change-credential.spec.ts b/tests/e2e/quickstarts/quickstart-nextjs-e2e/tests/change-credential.spec.ts
new file mode 100644
index 0000000..b372021
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nextjs-e2e/tests/change-credential.spec.ts
@@ -0,0 +1,114 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * nextjs/quickstart - changing a credential (password) via the Account page's Security tab.
+ * See quickstart-react-e2e/tests/change-credential.spec.ts for the full prerequisites; identical shape,
+ * different app.
+ *
+ * Signs in as a dedicated credential-test user (see credentialTestUser in shared/apps.ts),
+ * distinct from the shared TEST_USER_USERNAME every sign-in-out spec uses: TC001 below changes
+ * this user's password and changes it back (see the `finally` block), and the suite runs
+ * `fullyParallel`, so mutating the shared user's password would race every other
+ * concurrently-running spec's login across every app. The two tests in this file are run
+ * serially (below) so they don't race each other over their own shared dedicated user either.
+ */
+
+import {credentialTestUser, SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {Timeouts} from '../../../shared/constants/timeouts.ts';
+import {expect, test} from '../fixtures.ts';
+import {setUserPassword} from '../../../shared/utils/users-api/index.ts';
+
+const appUrl = sampleAppUrl(SampleApps.NEXTJS);
+const {username, password} = credentialTestUser(SampleApps.NEXTJS);
+// Derived from the real password rather than hardcoded, so this works regardless of what
+// policy the schema's password attribute is configured with in a given environment.
+const tempPassword = `${password}-Tmp1!`;
+
+test.describe.configure({mode: 'serial'});
+
+test.describe('nextjs/quickstart - Change credential', () => {
+ test.beforeEach(() => setUserPassword(username, password));
+
+ test('TC001: a password change via the Security tab takes effect and can be reverted', async ({
+ nextjsQuickstartPage,
+ }) => {
+ // Three full redirect-login round trips plus two credential submits, versus one round trip
+ // for a typical test in this suite. Next.js adds SSR overhead to every OAuth round trip that
+ // pure-CSR apps (react, vue) avoid, so this test needs extra budget beyond the 2× that would
+ // cover a CSR equivalent.
+ test.setTimeout(Timeouts.GLOBAL_TEST * 3);
+
+ await nextjsQuickstartPage.goto(appUrl);
+ await nextjsQuickstartPage.verifyHomePageLoaded();
+ await nextjsQuickstartPage.clickSignInButton();
+ await nextjsQuickstartPage.verifyLoginPageLoaded();
+ await nextjsQuickstartPage.login(username, password);
+ await nextjsQuickstartPage.verifyLoggedIn();
+
+ await nextjsQuickstartPage.openSecurityTab();
+
+ try {
+ await nextjsQuickstartPage.changeCredential('Change password', tempPassword);
+
+ // Prove the change landed server-side, not just that the UI collapsed the form: sign
+ // out and back in using the new password.
+ await nextjsQuickstartPage.logout();
+ await nextjsQuickstartPage.verifyLoggedOut();
+
+ await nextjsQuickstartPage.clickSignInButton();
+ await nextjsQuickstartPage.verifyLoginPageLoaded();
+ await nextjsQuickstartPage.login(username, tempPassword);
+ await nextjsQuickstartPage.verifyLoggedIn();
+
+ await nextjsQuickstartPage.openSecurityTab();
+ } finally {
+ // Always attempt to restore the shared test user's original password, even if an
+ // assertion above failed. The try block can fail anywhere from right after the password
+ // was changed to tempPassword through to confirming the re-login with it, and every one of
+ // those failure points leaves the page signed out (logout already happened by then) with
+ // the password already changed server-side - so if there's no active session, sign back in
+ // with tempPassword (the password this point in the flow implies is current) before
+ // reverting, rather than assuming the try block left us signed in and on the Security tab.
+ if (!(await nextjsQuickstartPage.isLoggedIn())) {
+ await nextjsQuickstartPage.clickSignInButton();
+ await nextjsQuickstartPage.verifyLoginPageLoaded();
+ await nextjsQuickstartPage.login(username, tempPassword);
+ await nextjsQuickstartPage.verifyLoggedIn();
+ }
+ await nextjsQuickstartPage.openSecurityTab();
+ await nextjsQuickstartPage.changeCredential('Change password', password);
+ }
+
+ // The restore itself also has to have actually worked, or the next test to sign in with
+ // the original password would fail.
+ await nextjsQuickstartPage.logout();
+ await nextjsQuickstartPage.verifyLoggedOut();
+ await nextjsQuickstartPage.clickSignInButton();
+ await nextjsQuickstartPage.verifyLoginPageLoaded();
+ await nextjsQuickstartPage.login(username, password);
+ await nextjsQuickstartPage.verifyLoggedIn();
+ });
+
+ test('TC002: the submit button stays disabled until the new value and confirmation match', async ({
+ nextjsQuickstartPage,
+ }) => {
+ await nextjsQuickstartPage.goto(appUrl);
+ await nextjsQuickstartPage.verifyHomePageLoaded();
+ await nextjsQuickstartPage.clickSignInButton();
+ await nextjsQuickstartPage.verifyLoginPageLoaded();
+ await nextjsQuickstartPage.login(username, password);
+ await nextjsQuickstartPage.verifyLoggedIn();
+
+ await nextjsQuickstartPage.openSecurityTab();
+ await nextjsQuickstartPage.toggleCredential('Change password');
+
+ expect(await nextjsQuickstartPage.isCredentialSubmitDisabled()).toBe(true);
+
+ await nextjsQuickstartPage.fillCredentialFields('mismatch-one', 'mismatch-two');
+ expect(await nextjsQuickstartPage.isCredentialSubmitDisabled()).toBe(true);
+
+ // Collapse without submitting - nothing was written, so there is nothing to restore.
+ await nextjsQuickstartPage.toggleCredential('Change password');
+ });
+});
diff --git a/tests/e2e/quickstarts/quickstart-nextjs-e2e/tests/sign-in-out.spec.ts b/tests/e2e/quickstarts/quickstart-nextjs-e2e/tests/sign-in-out.spec.ts
new file mode 100644
index 0000000..5536c9b
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nextjs-e2e/tests/sign-in-out.spec.ts
@@ -0,0 +1,77 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * nextjs/quickstart - sign in and sign out via the redirect flow. Run in redirect mode for this
+ * suite (NEXT_PUBLIC_THUNDERID_CLIENT_ID set) rather than its native default, see
+ * playwright.config.ts. See quickstart-react-e2e/tests/sign-in-out.spec.ts for the rest of the prerequisites.
+ */
+
+import {SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {expect, test} from '../fixtures.ts';
+import {ProfileFieldLabels} from '../../../shared/pages/thunderid-web-sample.page.ts';
+import {decodeJwtPayload} from '../../../shared/utils/jwt/index.ts';
+
+const appUrl = sampleAppUrl(SampleApps.NEXTJS);
+const username = process.env.TEST_USER_USERNAME!;
+const password = process.env.TEST_USER_PASSWORD!;
+
+test.describe('nextjs/quickstart - Sign in and Sign out', () => {
+ test('TC001: signs in with valid credentials', async ({nextjsQuickstartPage}) => {
+ await nextjsQuickstartPage.goto(appUrl);
+ await nextjsQuickstartPage.verifyHomePageLoaded();
+
+ await nextjsQuickstartPage.clickSignInButton();
+ await nextjsQuickstartPage.verifyLoginPageLoaded();
+
+ await nextjsQuickstartPage.login(username, password);
+ await nextjsQuickstartPage.verifyLoggedIn();
+ });
+
+ test('TC002: signs out after a successful sign-in', async ({nextjsQuickstartPage}) => {
+ await nextjsQuickstartPage.goto(appUrl);
+ await nextjsQuickstartPage.verifyHomePageLoaded();
+ await nextjsQuickstartPage.clickSignInButton();
+ await nextjsQuickstartPage.verifyLoginPageLoaded();
+ await nextjsQuickstartPage.login(username, password);
+ await nextjsQuickstartPage.verifyLoggedIn();
+
+ await nextjsQuickstartPage.logout();
+ await nextjsQuickstartPage.verifyLoggedOut();
+ });
+
+ test('TC003: token debug page displays a valid access token', async ({nextjsQuickstartPage}) => {
+ await nextjsQuickstartPage.goto(appUrl);
+ await nextjsQuickstartPage.verifyHomePageLoaded();
+ await nextjsQuickstartPage.clickSignInButton();
+ await nextjsQuickstartPage.verifyLoginPageLoaded();
+ await nextjsQuickstartPage.login(username, password);
+ await nextjsQuickstartPage.verifyLoggedIn();
+
+ await nextjsQuickstartPage.openTokenDebug();
+ await nextjsQuickstartPage.verifyTokenDebugLoaded();
+
+ const token = await nextjsQuickstartPage.getDisplayedAccessToken();
+ expect(token.split('.')).toHaveLength(3);
+
+ const payload = decodeJwtPayload(token);
+ expect(payload.sub).toBeTruthy();
+ expect(payload.exp as number).toBeGreaterThan(Math.floor(Date.now() / 1000));
+ });
+
+ test('TC004: profile changes made via Manage Profile are reflected', async ({nextjsQuickstartPage}) => {
+ await nextjsQuickstartPage.goto(appUrl);
+ await nextjsQuickstartPage.verifyHomePageLoaded();
+ await nextjsQuickstartPage.clickSignInButton();
+ await nextjsQuickstartPage.verifyLoginPageLoaded();
+ await nextjsQuickstartPage.login(username, password);
+ await nextjsQuickstartPage.verifyLoggedIn();
+
+ await nextjsQuickstartPage.openManageProfile();
+ await nextjsQuickstartPage.editProfileField(ProfileFieldLabels.givenName, 'Profile');
+ await nextjsQuickstartPage.editProfileField(ProfileFieldLabels.familyName, 'Updated');
+
+ await nextjsQuickstartPage.verifyProfileFieldValue(ProfileFieldLabels.givenName, 'Profile');
+ await nextjsQuickstartPage.verifyProfileFieldValue(ProfileFieldLabels.familyName, 'Updated');
+ });
+});
diff --git a/tests/e2e/quickstarts/quickstart-node-e2e/README.md b/tests/e2e/quickstarts/quickstart-node-e2e/README.md
new file mode 100644
index 0000000..2e19b33
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-node-e2e/README.md
@@ -0,0 +1,17 @@
+# ThunderID Node.js Quickstart E2E
+
+Playwright suite for [`quickstarts/quickstart-node`](../../../../quickstarts/quickstart-node). It starts the sample from its own sources with its published SDK, signs in against a real ThunderID server, and checks:
+
+- The CLI gets an access token with the `client_credentials` grant and exits cleanly. There is no browser UI: the spec runs `node index.mjs` with the client in its environment, after `npm ci` in the sample when it has no `node_modules`.
+
+## Run
+
+Start a ThunderID server first (see the [E2E README](../../README.md)), then, from `tests/e2e`:
+
+```bash
+npm ci
+npx playwright install chromium
+npm test -w quickstarts/quickstart-node-e2e
+```
+
+The global setup imports the OAuth2 client `JS_SDK_E2E_NODE` and creates the test user. Set `SAMPLES_ROOT` to run against another samples checkout.
diff --git a/tests/e2e/quickstarts/quickstart-node-e2e/package.json b/tests/e2e/quickstarts/quickstart-node-e2e/package.json
new file mode 100644
index 0000000..9550430
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-node-e2e/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@thunderid/quickstart-node-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "E2E suite of quickstarts/quickstart-node, a client_credentials CLI",
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+}
diff --git a/tests/e2e/quickstarts/quickstart-node-e2e/playwright.config.ts b/tests/e2e/quickstarts/quickstart-node-e2e/playwright.config.ts
new file mode 100644
index 0000000..7665cce
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-node-e2e/playwright.config.ts
@@ -0,0 +1,7 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {defineSampleConfig} from '../../shared/playwright.ts';
+
+// A CLI with no browser UI: the spec spawns it, so there is no web server to start.
+export default defineSampleConfig({app: 'NODE'});
diff --git a/tests/e2e/quickstarts/quickstart-node-e2e/tests/client-credentials.spec.ts b/tests/e2e/quickstarts/quickstart-node-e2e/tests/client-credentials.spec.ts
new file mode 100644
index 0000000..b4f9f75
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-node-e2e/tests/client-credentials.spec.ts
@@ -0,0 +1,63 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * quickstarts/quickstart-node - a service-to-service CLI, not a browser app: it authenticates
+ * with the OAuth2 `client_credentials` grant (lib/AuthService.mjs) and prints the result. There is
+ * no page to drive, so this spawns the CLI directly and asserts it exits 0 having obtained a token.
+ */
+
+import {type ChildProcess, execFileSync, spawn} from 'node:child_process';
+import fs from 'node:fs';
+import {expect, test} from '@playwright/test';
+import {SampleApps, sampleDir} from '../../../shared/apps.ts';
+import {Timeouts} from '../../../shared/constants/timeouts.ts';
+import {readEnvFile} from '../../../shared/utils/import-config/index.ts';
+
+const appDir = sampleDir(SampleApps.NODE);
+const clients = readEnvFile(new URL('../../../shared/thunderid-config/sample-apps.env', import.meta.url).pathname);
+
+test.describe('quickstarts/quickstart-node - client_credentials', () => {
+ test.beforeAll(() => {
+ // No dev server to install it, so install the sample from its lockfile here.
+ if (!fs.existsSync(`${appDir}/node_modules`)) {
+ execFileSync('npm', ['ci', '--no-audit', '--no-fund'], {cwd: appDir, stdio: 'inherit'});
+ }
+ });
+
+ test('TC001: obtains an access token and exits cleanly', async () => {
+ test.setTimeout(Timeouts.GLOBAL_TEST * 3);
+ let child: ChildProcess | undefined;
+
+ try {
+ const result = await new Promise<{code: number | null; stderr: string; stdout: string}>((resolve, reject) => {
+ // `timeout` bounds a hung token request instead of leaving the child running: Playwright's
+ // own test timeout never kills a spawned child process.
+ child = spawn('node', ['index.mjs'], {
+ cwd: appDir,
+ env: {
+ ...process.env,
+ NODE_TLS_REJECT_UNAUTHORIZED: '0',
+ THUNDERID_BASE_URL: process.env.SERVER_URL!,
+ THUNDERID_CLIENT_ID: clients.NODE_CLIENT_ID as string,
+ THUNDERID_CLIENT_SECRET: clients.NODE_CLIENT_SECRET as string,
+ },
+ timeout: Timeouts.DEFAULT_ACTION,
+ });
+ let stdout = '';
+ let stderr = '';
+ child.stdout!.on('data', (chunk: Buffer) => (stdout += chunk.toString()));
+ child.stderr!.on('data', (chunk: Buffer) => (stderr += chunk.toString()));
+ child.on('error', reject);
+ child.on('close', (code) => resolve({code, stderr, stdout}));
+ });
+
+ expect(result.code, `stdout:\n${result.stdout}\nstderr:\n${result.stderr}`).toBe(0);
+ // lib/ui.mjs's printAuthenticated() prints this banner once client_credentials succeeds.
+ expect(result.stdout).toContain('AUTHENTICATED');
+ } finally {
+ // No-op if the process already exited.
+ child?.kill();
+ }
+ });
+});
diff --git a/tests/e2e/quickstarts/quickstart-nuxt-e2e/README.md b/tests/e2e/quickstarts/quickstart-nuxt-e2e/README.md
new file mode 100644
index 0000000..4ffc925
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nuxt-e2e/README.md
@@ -0,0 +1,22 @@
+# ThunderID Nuxt Quickstart E2E
+
+Playwright suite for [`quickstarts/quickstart-nuxt`](../../../../quickstarts/quickstart-nuxt). It starts the sample from its own sources with its published SDK, signs in against a real ThunderID server, and checks:
+
+- Sign in and sign out through the redirect flow, which the suite turns on by setting a client ID
+- The token debug page shows a valid access token
+- Profile edits on the Account page are saved
+- A password change on the Security tab takes effect and can be reverted
+
+## Run
+
+Start a ThunderID server first (see the [E2E README](../../README.md)), then, from `tests/e2e`:
+
+```bash
+npm ci
+npx playwright install chromium
+npm test -w quickstarts/quickstart-nuxt-e2e
+```
+
+Playwright installs the sample with `npm ci` when it has no `node_modules`, and serves it on port 3002 with the OAuth2 client `JS_SDK_E2E_NUXT`. The global setup imports that client and creates the test users. Set `SAMPLES_ROOT` to run against another samples checkout, such as a `git archive` export.
+
+The registered redirect URI fixes port 3002, so nothing else may listen on it.
diff --git a/tests/e2e/quickstarts/quickstart-nuxt-e2e/fixtures.ts b/tests/e2e/quickstarts/quickstart-nuxt-e2e/fixtures.ts
new file mode 100644
index 0000000..009b30f
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nuxt-e2e/fixtures.ts
@@ -0,0 +1,13 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {test as base} from '@playwright/test';
+import {ThunderIDAccountPageSamplePage} from '../../shared/pages/thunderid-web-sample.page.ts';
+
+export const test = base.extend<{nuxtQuickstartPage: ThunderIDAccountPageSamplePage}>({
+ nuxtQuickstartPage: async ({page}, use) => {
+ await use(new ThunderIDAccountPageSamplePage(page));
+ },
+});
+
+export {expect} from '@playwright/test';
diff --git a/tests/e2e/quickstarts/quickstart-nuxt-e2e/package.json b/tests/e2e/quickstarts/quickstart-nuxt-e2e/package.json
new file mode 100644
index 0000000..3a39c09
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nuxt-e2e/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@thunderid/quickstart-nuxt-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "E2E suite of quickstarts/quickstart-nuxt, in redirect mode",
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+}
diff --git a/tests/e2e/quickstarts/quickstart-nuxt-e2e/playwright.config.ts b/tests/e2e/quickstarts/quickstart-nuxt-e2e/playwright.config.ts
new file mode 100644
index 0000000..3f04bc2
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nuxt-e2e/playwright.config.ts
@@ -0,0 +1,26 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {randomBytes} from 'node:crypto';
+import {sharedClientVariable} from '../../shared/apps.ts';
+import {defineSampleConfig, sampleWebServer} from '../../shared/playwright.ts';
+
+// A client ID puts the sample in redirect mode, so its native-flow variables stay unset. The
+// registered redirect URI fixes the port at 3002.
+const sessionSecret = randomBytes(32).toString('base64');
+
+const config = defineSampleConfig({
+ app: 'NUXT',
+ webServer: sampleWebServer('NUXT', {
+ command: 'npm run dev -- --port 3002',
+ env: {
+ NODE_TLS_REJECT_UNAUTHORIZED: '0',
+ NUXT_PUBLIC_THUNDERID_BASE_URL: process.env.SERVER_URL!,
+ NUXT_PUBLIC_THUNDERID_CLIENT_ID: sharedClientVariable('NUXT_CLIENT_ID'),
+ THUNDERID_CLIENT_SECRET: sharedClientVariable('NUXT_CLIENT_SECRET'),
+ THUNDERID_SESSION_SECRET: sessionSecret,
+ },
+ }),
+});
+
+export default config;
diff --git a/tests/e2e/quickstarts/quickstart-nuxt-e2e/tests/change-credential.spec.ts b/tests/e2e/quickstarts/quickstart-nuxt-e2e/tests/change-credential.spec.ts
new file mode 100644
index 0000000..a21e43a
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nuxt-e2e/tests/change-credential.spec.ts
@@ -0,0 +1,113 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * nuxt/quickstart - changing a credential (password) via the Account page's Security tab. See
+ * quickstart-react-e2e/tests/change-credential.spec.ts for the full prerequisites; identical shape,
+ * different app.
+ *
+ * Signs in as a dedicated credential-test user (see credentialTestUser in shared/apps.ts),
+ * distinct from the shared TEST_USER_USERNAME every sign-in-out spec uses: TC001 below changes
+ * this user's password and changes it back (see the `finally` block), and the suite runs
+ * `fullyParallel`, so mutating the shared user's password would race every other
+ * concurrently-running spec's login across every app. The two tests in this file are run
+ * serially (below) so they don't race each other over their own shared dedicated user either.
+ */
+
+import {credentialTestUser, SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {Timeouts} from '../../../shared/constants/timeouts.ts';
+import {expect, test} from '../fixtures.ts';
+import {setUserPassword} from '../../../shared/utils/users-api/index.ts';
+
+const appUrl = sampleAppUrl(SampleApps.NUXT);
+const {username, password} = credentialTestUser(SampleApps.NUXT);
+// Derived from the real password rather than hardcoded, so this works regardless of what
+// policy the schema's password attribute is configured with in a given environment.
+const tempPassword = `${password}-Tmp1!`;
+
+test.describe.configure({mode: 'serial'});
+
+test.describe('nuxt/quickstart - Change credential', () => {
+ test.beforeEach(() => setUserPassword(username, password));
+
+ test('TC001: a password change via the Security tab takes effect and can be reverted', async ({
+ nuxtQuickstartPage,
+ }) => {
+ // Three full redirect-login round trips plus two credential submits, versus one round trip
+ // for a typical test in this suite - the default per-test timeout leaves too little margin
+ // for normal CI slowness.
+ test.setTimeout(Timeouts.GLOBAL_TEST * 2);
+
+ await nuxtQuickstartPage.goto(appUrl);
+ await nuxtQuickstartPage.verifyHomePageLoaded();
+ await nuxtQuickstartPage.clickSignInButton();
+ await nuxtQuickstartPage.verifyLoginPageLoaded();
+ await nuxtQuickstartPage.login(username, password);
+ await nuxtQuickstartPage.verifyLoggedIn();
+
+ await nuxtQuickstartPage.openSecurityTab();
+
+ try {
+ await nuxtQuickstartPage.changeCredential('Change password', tempPassword);
+
+ // Prove the change landed server-side, not just that the UI collapsed the form: sign
+ // out and back in using the new password.
+ await nuxtQuickstartPage.logout();
+ await nuxtQuickstartPage.verifyLoggedOut();
+
+ await nuxtQuickstartPage.clickSignInButton();
+ await nuxtQuickstartPage.verifyLoginPageLoaded();
+ await nuxtQuickstartPage.login(username, tempPassword);
+ await nuxtQuickstartPage.verifyLoggedIn();
+
+ await nuxtQuickstartPage.openSecurityTab();
+ } finally {
+ // Always attempt to restore the shared test user's original password, even if an
+ // assertion above failed. The try block can fail anywhere from right after the password
+ // was changed to tempPassword through to confirming the re-login with it, and every one of
+ // those failure points leaves the page signed out (logout already happened by then) with
+ // the password already changed server-side - so if there's no active session, sign back in
+ // with tempPassword (the password this point in the flow implies is current) before
+ // reverting, rather than assuming the try block left us signed in and on the Security tab.
+ if (!(await nuxtQuickstartPage.isLoggedIn())) {
+ await nuxtQuickstartPage.clickSignInButton();
+ await nuxtQuickstartPage.verifyLoginPageLoaded();
+ await nuxtQuickstartPage.login(username, tempPassword);
+ await nuxtQuickstartPage.verifyLoggedIn();
+ }
+ await nuxtQuickstartPage.openSecurityTab();
+ await nuxtQuickstartPage.changeCredential('Change password', password);
+ }
+
+ // The restore itself also has to have actually worked, or the next test to sign in with
+ // the original password would fail.
+ await nuxtQuickstartPage.logout();
+ await nuxtQuickstartPage.verifyLoggedOut();
+ await nuxtQuickstartPage.clickSignInButton();
+ await nuxtQuickstartPage.verifyLoginPageLoaded();
+ await nuxtQuickstartPage.login(username, password);
+ await nuxtQuickstartPage.verifyLoggedIn();
+ });
+
+ test('TC002: the submit button stays disabled until the new value and confirmation match', async ({
+ nuxtQuickstartPage,
+ }) => {
+ await nuxtQuickstartPage.goto(appUrl);
+ await nuxtQuickstartPage.verifyHomePageLoaded();
+ await nuxtQuickstartPage.clickSignInButton();
+ await nuxtQuickstartPage.verifyLoginPageLoaded();
+ await nuxtQuickstartPage.login(username, password);
+ await nuxtQuickstartPage.verifyLoggedIn();
+
+ await nuxtQuickstartPage.openSecurityTab();
+ await nuxtQuickstartPage.toggleCredential('Change password');
+
+ expect(await nuxtQuickstartPage.isCredentialSubmitDisabled()).toBe(true);
+
+ await nuxtQuickstartPage.fillCredentialFields('mismatch-one', 'mismatch-two');
+ expect(await nuxtQuickstartPage.isCredentialSubmitDisabled()).toBe(true);
+
+ // Collapse without submitting - nothing was written, so there is nothing to restore.
+ await nuxtQuickstartPage.toggleCredential('Change password');
+ });
+});
diff --git a/tests/e2e/quickstarts/quickstart-nuxt-e2e/tests/sign-in-out.spec.ts b/tests/e2e/quickstarts/quickstart-nuxt-e2e/tests/sign-in-out.spec.ts
new file mode 100644
index 0000000..d16b62e
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-nuxt-e2e/tests/sign-in-out.spec.ts
@@ -0,0 +1,76 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * nuxt/quickstart - sign in and sign out via the redirect flow (already the checked-in default).
+ * See quickstart-react-e2e/tests/sign-in-out.spec.ts for the rest of the prerequisites.
+ */
+
+import {SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {expect, test} from '../fixtures.ts';
+import {ProfileFieldLabels} from '../../../shared/pages/thunderid-web-sample.page.ts';
+import {decodeJwtPayload} from '../../../shared/utils/jwt/index.ts';
+
+const appUrl = sampleAppUrl(SampleApps.NUXT);
+const username = process.env.TEST_USER_USERNAME!;
+const password = process.env.TEST_USER_PASSWORD!;
+
+test.describe('nuxt/quickstart - Sign in and Sign out', () => {
+ test('TC001: signs in with valid credentials', async ({nuxtQuickstartPage}) => {
+ await nuxtQuickstartPage.goto(appUrl);
+ await nuxtQuickstartPage.verifyHomePageLoaded();
+
+ await nuxtQuickstartPage.clickSignInButton();
+ await nuxtQuickstartPage.verifyLoginPageLoaded();
+
+ await nuxtQuickstartPage.login(username, password);
+ await nuxtQuickstartPage.verifyLoggedIn();
+ });
+
+ test('TC002: signs out after a successful sign-in', async ({nuxtQuickstartPage}) => {
+ await nuxtQuickstartPage.goto(appUrl);
+ await nuxtQuickstartPage.verifyHomePageLoaded();
+ await nuxtQuickstartPage.clickSignInButton();
+ await nuxtQuickstartPage.verifyLoginPageLoaded();
+ await nuxtQuickstartPage.login(username, password);
+ await nuxtQuickstartPage.verifyLoggedIn();
+
+ await nuxtQuickstartPage.logout();
+ await nuxtQuickstartPage.verifyLoggedOut();
+ });
+
+ test('TC003: token debug page displays a valid access token', async ({nuxtQuickstartPage}) => {
+ await nuxtQuickstartPage.goto(appUrl);
+ await nuxtQuickstartPage.verifyHomePageLoaded();
+ await nuxtQuickstartPage.clickSignInButton();
+ await nuxtQuickstartPage.verifyLoginPageLoaded();
+ await nuxtQuickstartPage.login(username, password);
+ await nuxtQuickstartPage.verifyLoggedIn();
+
+ await nuxtQuickstartPage.openTokenDebug();
+ await nuxtQuickstartPage.verifyTokenDebugLoaded();
+
+ const token = await nuxtQuickstartPage.getDisplayedAccessToken();
+ expect(token.split('.')).toHaveLength(3);
+
+ const payload = decodeJwtPayload(token);
+ expect(payload.sub).toBeTruthy();
+ expect(payload.exp as number).toBeGreaterThan(Math.floor(Date.now() / 1000));
+ });
+
+ test('TC004: profile changes made via Manage Profile are reflected', async ({nuxtQuickstartPage}) => {
+ await nuxtQuickstartPage.goto(appUrl);
+ await nuxtQuickstartPage.verifyHomePageLoaded();
+ await nuxtQuickstartPage.clickSignInButton();
+ await nuxtQuickstartPage.verifyLoginPageLoaded();
+ await nuxtQuickstartPage.login(username, password);
+ await nuxtQuickstartPage.verifyLoggedIn();
+
+ await nuxtQuickstartPage.openManageProfile();
+ await nuxtQuickstartPage.editProfileField(ProfileFieldLabels.givenName, 'Profile');
+ await nuxtQuickstartPage.editProfileField(ProfileFieldLabels.familyName, 'Updated');
+
+ await nuxtQuickstartPage.verifyProfileFieldValue(ProfileFieldLabels.givenName, 'Profile');
+ await nuxtQuickstartPage.verifyProfileFieldValue(ProfileFieldLabels.familyName, 'Updated');
+ });
+});
diff --git a/tests/e2e/quickstarts/quickstart-react-b2b-e2e/README.md b/tests/e2e/quickstarts/quickstart-react-b2b-e2e/README.md
new file mode 100644
index 0000000..c72d212
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-react-b2b-e2e/README.md
@@ -0,0 +1,21 @@
+# ThunderID React B2B Quickstart E2E
+
+Playwright suite for [`quickstarts/quickstart-react-b2b`](../../../../quickstarts/quickstart-react-b2b). It starts the sample from its own sources with its published SDK, signs in against a real ThunderID server, and checks:
+
+- Registering a company signs its first admin in to it, with the company, the `React B2B Admin` role and the `org` scope in the token
+- An account shared into two companies switches between them with the organization unit switcher
+- Sign-out
+
+## Run
+
+Start a ThunderID server first (see the [E2E README](../../README.md)), then, from `tests/e2e`:
+
+```bash
+npm ci
+npx playwright install chromium
+npm test -w quickstarts/quickstart-react-b2b-e2e
+```
+
+Playwright installs the sample with `npm ci` when it has no `node_modules`, and serves it on port 5173 with the sample's own OAuth2 client `REACT_B2B_QUICKSTART`. The global setup imports that client and creates the test users. Set `SAMPLES_ROOT` to run against another samples checkout, such as a `git archive` export.
+
+The global setup imports the sample's own `thunderid-config/thunderid-config.yaml`, which needs a ThunderID server newer than 1.1.1 (it uses the `org` permission). The sample's Vite config and redirect URIs fix port 5173, shared with `quickstart-browser`. The import sets the server-wide `defaultResourceServer`; set `E2E_SKIP_SERVER_CONFIGS=true` to leave it out on a shared server (this app names its resource itself, so its token should still carry `org`). Every run registers new companies, which stay on the server.
diff --git a/tests/e2e/quickstarts/quickstart-react-b2b-e2e/ci-skip b/tests/e2e/quickstarts/quickstart-react-b2b-e2e/ci-skip
new file mode 100644
index 0000000..7a45cea
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-react-b2b-e2e/ci-skip
@@ -0,0 +1 @@
+Needs a ThunderID server built from main: the latest release rejects this sample's configuration (organization unit permissions and flows). Remove this file once a release supports it.
diff --git a/tests/e2e/quickstarts/quickstart-react-b2b-e2e/fixtures.ts b/tests/e2e/quickstarts/quickstart-react-b2b-e2e/fixtures.ts
new file mode 100644
index 0000000..0a33a37
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-react-b2b-e2e/fixtures.ts
@@ -0,0 +1,13 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {test as base} from '@playwright/test';
+import {B2BQuickstartPage} from '../../shared/pages/b2b-quickstart.page.ts';
+
+export const test = base.extend<{b2bPage: B2BQuickstartPage}>({
+ b2bPage: async ({page}, use) => {
+ await use(new B2BQuickstartPage(page));
+ },
+});
+
+export {expect} from '@playwright/test';
diff --git a/tests/e2e/quickstarts/quickstart-react-b2b-e2e/package.json b/tests/e2e/quickstarts/quickstart-react-b2b-e2e/package.json
new file mode 100644
index 0000000..eacea71
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-react-b2b-e2e/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@thunderid/quickstart-react-b2b-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "E2E suite of quickstarts/quickstart-react-b2b",
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+}
diff --git a/tests/e2e/quickstarts/quickstart-react-b2b-e2e/playwright.config.ts b/tests/e2e/quickstarts/quickstart-react-b2b-e2e/playwright.config.ts
new file mode 100644
index 0000000..26e02e2
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-react-b2b-e2e/playwright.config.ts
@@ -0,0 +1,21 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {defineSampleConfig, sampleWebServer} from '../../shared/playwright.ts';
+
+// The sample's own thunderid-config (imported by the global setup) registers the client with
+// redirect URIs on http://localhost:5173, and its vite.config.js fixes that port.
+const config = defineSampleConfig({
+ app: 'REACT_B2B',
+ webServer: sampleWebServer('REACT_B2B', {
+ command: 'npm run dev',
+ env: {
+ VITE_THUNDERID_BASE_URL: process.env.SERVER_URL!,
+ VITE_THUNDERID_CLIENT_ID: 'REACT_B2B_QUICKSTART',
+ VITE_THUNDERID_RESOURCE: `${process.env.SERVER_URL}/mcp`,
+ VITE_THUNDERID_SIGN_IN_FLOW_ID: '019f0b10-0000-7000-8000-000000000021',
+ },
+ }),
+});
+
+export default config;
diff --git a/tests/e2e/quickstarts/quickstart-react-b2b-e2e/tests/companies.spec.ts b/tests/e2e/quickstarts/quickstart-react-b2b-e2e/tests/companies.spec.ts
new file mode 100644
index 0000000..99290cf
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-react-b2b-e2e/tests/companies.spec.ts
@@ -0,0 +1,72 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * quickstarts/quickstart-react-b2b - company sign-up, the organization and roles in the token, and
+ * switching between companies. Every run registers new companies, since handles and usernames are
+ * unique; they stay on the server.
+ */
+
+import {SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {newCompany} from '../../../shared/pages/b2b-gate.page.ts';
+import {
+ createChildOrganizationUnit,
+ createDefaultOuUser,
+ shareUserWithAllChildUnits,
+} from '../../../shared/utils/organization-units/index.ts';
+import {expect, test} from '../fixtures.ts';
+
+const appUrl = sampleAppUrl(SampleApps.REACT_B2B);
+const USER_TYPE = 'react-b2b-user';
+
+test.describe('quickstarts/quickstart-react-b2b - Companies', () => {
+ test('TC001: registering a company signs its first admin in to it', async ({b2bPage}) => {
+ const company = newCompany('react-b2b');
+ await b2bPage.goto(appUrl);
+ await b2bPage.clickSignInButton();
+ await b2bPage.registerCompany(company, 'My account belongs to this company');
+
+ await b2bPage.verifySignedInTo(company.name);
+ expect(await b2bPage.claim('ouHandle')).toBe(company.handle);
+ expect(await b2bPage.claim('ouName')).toBe(company.name);
+ expect(await b2bPage.claim('roles')).toContain('React B2B Admin');
+ expect((await b2bPage.claim('scope')).split(' ')).toContain('org');
+ });
+
+ test('TC002: an account in two companies switches between them without signing in again', async ({b2bPage}) => {
+ // The Console's "Affiliations" setup from the sample's README, through the API: two companies
+ // and an account in the Default organization unit shared into every company beneath it.
+ const alpha = newCompany('react-b2b-alpha');
+ const beta = newCompany('react-b2b-beta');
+ await createChildOrganizationUnit(alpha.handle, alpha.name);
+ await createChildOrganizationUnit(beta.handle, beta.name);
+ const user = await createDefaultOuUser(USER_TYPE, {
+ email: alpha.email,
+ password: alpha.password,
+ username: alpha.username,
+ });
+ await shareUserWithAllChildUnits(user.id);
+
+ await b2bPage.goto(appUrl);
+ await b2bPage.clickSignInButton();
+ await b2bPage.login(alpha.username, alpha.password);
+ await b2bPage.chooseCompany(alpha.handle);
+ await b2bPage.verifySignedInTo(alpha.name);
+ expect(await b2bPage.claim('ouHandle')).toBe(alpha.handle);
+
+ await b2bPage.switchTo(alpha.name, beta.name);
+ await b2bPage.verifySignedInTo(beta.name);
+ expect(await b2bPage.claim('ouHandle')).toBe(beta.handle);
+ });
+
+ test('TC003: signs out after registering a company', async ({b2bPage}) => {
+ const company = newCompany('react-b2b');
+ await b2bPage.goto(appUrl);
+ await b2bPage.clickSignInButton();
+ await b2bPage.registerCompany(company, 'My account belongs to this company');
+ await b2bPage.verifySignedInTo(company.name);
+
+ await b2bPage.logout();
+ await b2bPage.verifyLoggedOut();
+ });
+});
diff --git a/tests/e2e/quickstarts/quickstart-react-e2e/README.md b/tests/e2e/quickstarts/quickstart-react-e2e/README.md
new file mode 100644
index 0000000..349d416
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-react-e2e/README.md
@@ -0,0 +1,20 @@
+# ThunderID React Quickstart E2E
+
+Playwright suite for [`quickstarts/quickstart-react`](../../../../quickstarts/quickstart-react). It starts the sample from its own sources with its published SDK, signs in against a real ThunderID server, and checks:
+
+- Sign in and sign out through the redirect flow
+- The token debug page shows a valid access token
+- Profile edits on the Account page are saved
+- A password change on the Security tab takes effect and can be reverted, and the form stays disabled until both values match
+
+## Run
+
+Start a ThunderID server first (see the [E2E README](../../README.md)), then, from `tests/e2e`:
+
+```bash
+npm ci
+npx playwright install chromium
+npm test -w quickstarts/quickstart-react-e2e
+```
+
+Playwright installs the sample with `npm ci` when it has no `node_modules`, and serves it on port 5174 with the OAuth2 client `JS_SDK_E2E_REACT`. The global setup imports that client and creates the test users. Set `SAMPLES_ROOT` to run against another samples checkout, such as a `git archive` export.
diff --git a/tests/e2e/quickstarts/quickstart-react-e2e/fixtures.ts b/tests/e2e/quickstarts/quickstart-react-e2e/fixtures.ts
new file mode 100644
index 0000000..e3ebd66
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-react-e2e/fixtures.ts
@@ -0,0 +1,13 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {test as base} from '@playwright/test';
+import {ThunderIDAccountPageSamplePage} from '../../shared/pages/thunderid-web-sample.page.ts';
+
+export const test = base.extend<{reactQuickstartPage: ThunderIDAccountPageSamplePage}>({
+ reactQuickstartPage: async ({page}, use) => {
+ await use(new ThunderIDAccountPageSamplePage(page));
+ },
+});
+
+export {expect} from '@playwright/test';
diff --git a/tests/e2e/quickstarts/quickstart-react-e2e/package.json b/tests/e2e/quickstarts/quickstart-react-e2e/package.json
new file mode 100644
index 0000000..760d9b0
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-react-e2e/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@thunderid/quickstart-react-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "E2E suite of quickstarts/quickstart-react",
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+}
diff --git a/tests/e2e/quickstarts/quickstart-react-e2e/playwright.config.ts b/tests/e2e/quickstarts/quickstart-react-e2e/playwright.config.ts
new file mode 100644
index 0000000..6078c34
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-react-e2e/playwright.config.ts
@@ -0,0 +1,18 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {sharedClientVariable} from '../../shared/apps.ts';
+import {defineSampleConfig, sampleWebServer} from '../../shared/playwright.ts';
+
+const config = defineSampleConfig({
+ app: 'REACT',
+ webServer: sampleWebServer('REACT', {
+ command: 'npm run dev -- --port 5174 --strictPort',
+ env: {
+ VITE_THUNDERID_BASE_URL: process.env.SERVER_URL!,
+ VITE_THUNDERID_CLIENT_ID: sharedClientVariable('REACT_CLIENT_ID'),
+ },
+ }),
+});
+
+export default config;
diff --git a/tests/e2e/quickstarts/quickstart-react-e2e/tests/change-credential.spec.ts b/tests/e2e/quickstarts/quickstart-react-e2e/tests/change-credential.spec.ts
new file mode 100644
index 0000000..b383c17
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-react-e2e/tests/change-credential.spec.ts
@@ -0,0 +1,94 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * react/quickstart - changing a credential (password) via the Account page's Security tab.
+ * See quickstart-react-e2e/tests/sign-in-out.spec.ts for the rest of the prerequisites.
+ *
+ * Signs in as a dedicated credential-test user (see credentialTestUser in shared/apps.ts),
+ * distinct from the shared TEST_USER_USERNAME every sign-in-out spec uses: TC001 below changes
+ * this user's password and changes it back (see the `finally` block), and the suite runs
+ * `fullyParallel`, so mutating the shared user's password would race every other
+ * concurrently-running spec's login across every app. The two tests in this file are run
+ * serially (below) so they don't race each other over their own shared dedicated user either.
+ */
+
+import {credentialTestUser, SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {expect, test} from '../fixtures.ts';
+import {setUserPassword} from '../../../shared/utils/users-api/index.ts';
+
+const appUrl = sampleAppUrl(SampleApps.REACT);
+const {username, password} = credentialTestUser(SampleApps.REACT);
+// Derived from the real password rather than hardcoded, so this works regardless of what
+// policy the schema's password attribute is configured with in a given environment.
+const tempPassword = `${password}-Tmp1!`;
+
+test.describe.configure({mode: 'serial'});
+
+test.describe('react/quickstart - Change credential', () => {
+ test.beforeEach(() => setUserPassword(username, password));
+
+ test('TC001: a password change via the Security tab takes effect and can be reverted', async ({
+ reactQuickstartPage,
+ }) => {
+ await reactQuickstartPage.goto(appUrl);
+ await reactQuickstartPage.verifyHomePageLoaded();
+ await reactQuickstartPage.clickSignInButton();
+ await reactQuickstartPage.verifyLoginPageLoaded();
+ await reactQuickstartPage.login(username, password);
+ await reactQuickstartPage.verifyLoggedIn();
+
+ await reactQuickstartPage.openSecurityTab();
+
+ try {
+ await reactQuickstartPage.changeCredential('Change password', tempPassword);
+
+ // Prove the change landed server-side, not just that the UI collapsed the form: sign
+ // out and back in using the new password.
+ await reactQuickstartPage.logout();
+ await reactQuickstartPage.verifyLoggedOut();
+
+ await reactQuickstartPage.clickSignInButton();
+ await reactQuickstartPage.verifyLoginPageLoaded();
+ await reactQuickstartPage.login(username, tempPassword);
+ await reactQuickstartPage.verifyLoggedIn();
+
+ await reactQuickstartPage.openSecurityTab();
+ } finally {
+ // Always attempt to restore the shared test user's original password, even if an
+ // assertion above failed.
+ await reactQuickstartPage.changeCredential('Change password', password);
+ }
+
+ // The restore itself also has to have actually worked, or the next test to sign in with
+ // the original password would fail.
+ await reactQuickstartPage.logout();
+ await reactQuickstartPage.verifyLoggedOut();
+ await reactQuickstartPage.clickSignInButton();
+ await reactQuickstartPage.verifyLoginPageLoaded();
+ await reactQuickstartPage.login(username, password);
+ await reactQuickstartPage.verifyLoggedIn();
+ });
+
+ test('TC002: the submit button stays disabled until the new value and confirmation match', async ({
+ reactQuickstartPage,
+ }) => {
+ await reactQuickstartPage.goto(appUrl);
+ await reactQuickstartPage.verifyHomePageLoaded();
+ await reactQuickstartPage.clickSignInButton();
+ await reactQuickstartPage.verifyLoginPageLoaded();
+ await reactQuickstartPage.login(username, password);
+ await reactQuickstartPage.verifyLoggedIn();
+
+ await reactQuickstartPage.openSecurityTab();
+ await reactQuickstartPage.toggleCredential('Change password');
+
+ expect(await reactQuickstartPage.isCredentialSubmitDisabled()).toBe(true);
+
+ await reactQuickstartPage.fillCredentialFields('mismatch-one', 'mismatch-two');
+ expect(await reactQuickstartPage.isCredentialSubmitDisabled()).toBe(true);
+
+ // Collapse without submitting - nothing was written, so there is nothing to restore.
+ await reactQuickstartPage.toggleCredential('Change password');
+ });
+});
diff --git a/tests/e2e/quickstarts/quickstart-react-e2e/tests/sign-in-out.spec.ts b/tests/e2e/quickstarts/quickstart-react-e2e/tests/sign-in-out.spec.ts
new file mode 100644
index 0000000..8b5861f
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-react-e2e/tests/sign-in-out.spec.ts
@@ -0,0 +1,81 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * react/quickstart - sign in and sign out via the redirect flow.
+ *
+ * Prerequisites (handled by playwright.config.ts and shared/setup/global-setup.ts):
+ * - The backend running, with react/quickstart's OAuth2 client imported
+ * (shared/thunderid-config/sample-apps.yaml)
+ * - react/quickstart running on its port (shared/apps.ts), started by playwright.config.ts
+ * - The shared E2E test user (TEST_USER_USERNAME / TEST_USER_PASSWORD)
+ */
+
+import {SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {expect, test} from '../fixtures.ts';
+import {ProfileFieldLabels} from '../../../shared/pages/thunderid-web-sample.page.ts';
+import {decodeJwtPayload} from '../../../shared/utils/jwt/index.ts';
+
+const appUrl = sampleAppUrl(SampleApps.REACT);
+const username = process.env.TEST_USER_USERNAME!;
+const password = process.env.TEST_USER_PASSWORD!;
+
+test.describe('react/quickstart - Sign in and Sign out', () => {
+ test('TC001: signs in with valid credentials', async ({reactQuickstartPage}) => {
+ await reactQuickstartPage.goto(appUrl);
+ await reactQuickstartPage.verifyHomePageLoaded();
+
+ await reactQuickstartPage.clickSignInButton();
+ await reactQuickstartPage.verifyLoginPageLoaded();
+
+ await reactQuickstartPage.login(username, password);
+ await reactQuickstartPage.verifyLoggedIn();
+ });
+
+ test('TC002: signs out after a successful sign-in', async ({reactQuickstartPage}) => {
+ await reactQuickstartPage.goto(appUrl);
+ await reactQuickstartPage.verifyHomePageLoaded();
+ await reactQuickstartPage.clickSignInButton();
+ await reactQuickstartPage.verifyLoginPageLoaded();
+ await reactQuickstartPage.login(username, password);
+ await reactQuickstartPage.verifyLoggedIn();
+
+ await reactQuickstartPage.logout();
+ await reactQuickstartPage.verifyLoggedOut();
+ });
+
+ test('TC003: token debug page displays a valid access token', async ({reactQuickstartPage}) => {
+ await reactQuickstartPage.goto(appUrl);
+ await reactQuickstartPage.verifyHomePageLoaded();
+ await reactQuickstartPage.clickSignInButton();
+ await reactQuickstartPage.verifyLoginPageLoaded();
+ await reactQuickstartPage.login(username, password);
+ await reactQuickstartPage.verifyLoggedIn();
+
+ await reactQuickstartPage.openTokenDebug();
+ await reactQuickstartPage.verifyTokenDebugLoaded();
+
+ const token = await reactQuickstartPage.getDisplayedAccessToken();
+ expect(token.split('.')).toHaveLength(3);
+
+ const payload = decodeJwtPayload(token);
+ expect(payload.sub).toBeTruthy();
+ expect(payload.exp as number).toBeGreaterThan(Math.floor(Date.now() / 1000));
+ });
+
+ test('TC004: profile changes made via Manage Profile are reflected', async ({reactQuickstartPage}) => {
+ await reactQuickstartPage.goto(appUrl);
+ await reactQuickstartPage.verifyHomePageLoaded();
+ await reactQuickstartPage.clickSignInButton();
+ await reactQuickstartPage.verifyLoginPageLoaded();
+ await reactQuickstartPage.login(username, password);
+ await reactQuickstartPage.verifyLoggedIn();
+
+ await reactQuickstartPage.openManageProfile();
+ await reactQuickstartPage.editProfileField(ProfileFieldLabels.givenName, 'Profile');
+ await reactQuickstartPage.editProfileField(ProfileFieldLabels.familyName, 'Updated');
+
+ await reactQuickstartPage.verifyProfileFieldValue(ProfileFieldLabels.givenName, 'Profile');
+ await reactQuickstartPage.verifyProfileFieldValue(ProfileFieldLabels.familyName, 'Updated');
+ });
+});
diff --git a/tests/e2e/quickstarts/quickstart-vue-e2e/README.md b/tests/e2e/quickstarts/quickstart-vue-e2e/README.md
new file mode 100644
index 0000000..f070501
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-vue-e2e/README.md
@@ -0,0 +1,20 @@
+# ThunderID Vue Quickstart E2E
+
+Playwright suite for [`quickstarts/quickstart-vue`](../../../../quickstarts/quickstart-vue). It starts the sample from its own sources with its published SDK, signs in against a real ThunderID server, and checks:
+
+- Sign in and sign out through the redirect flow
+- The token debug page shows a valid access token
+- Profile edits on the Account page are saved
+- A password change on the Security tab takes effect and can be reverted, and the form stays disabled until both values match
+
+## Run
+
+Start a ThunderID server first (see the [E2E README](../../README.md)), then, from `tests/e2e`:
+
+```bash
+npm ci
+npx playwright install chromium
+npm test -w quickstarts/quickstart-vue-e2e
+```
+
+Playwright installs the sample with `npm ci` when it has no `node_modules`, and serves it on port 5175 with the OAuth2 client `JS_SDK_E2E_VUE`. The global setup imports that client and creates the test users. Set `SAMPLES_ROOT` to run against another samples checkout, such as a `git archive` export.
diff --git a/tests/e2e/quickstarts/quickstart-vue-e2e/fixtures.ts b/tests/e2e/quickstarts/quickstart-vue-e2e/fixtures.ts
new file mode 100644
index 0000000..f45ff3b
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-vue-e2e/fixtures.ts
@@ -0,0 +1,13 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {test as base} from '@playwright/test';
+import {ThunderIDAccountPageSamplePage} from '../../shared/pages/thunderid-web-sample.page.ts';
+
+export const test = base.extend<{vueQuickstartPage: ThunderIDAccountPageSamplePage}>({
+ vueQuickstartPage: async ({page}, use) => {
+ await use(new ThunderIDAccountPageSamplePage(page));
+ },
+});
+
+export {expect} from '@playwright/test';
diff --git a/tests/e2e/quickstarts/quickstart-vue-e2e/package.json b/tests/e2e/quickstarts/quickstart-vue-e2e/package.json
new file mode 100644
index 0000000..99d55aa
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-vue-e2e/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@thunderid/quickstart-vue-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "E2E suite of quickstarts/quickstart-vue",
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+}
diff --git a/tests/e2e/quickstarts/quickstart-vue-e2e/playwright.config.ts b/tests/e2e/quickstarts/quickstart-vue-e2e/playwright.config.ts
new file mode 100644
index 0000000..66df197
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-vue-e2e/playwright.config.ts
@@ -0,0 +1,18 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {sharedClientVariable} from '../../shared/apps.ts';
+import {defineSampleConfig, sampleWebServer} from '../../shared/playwright.ts';
+
+const config = defineSampleConfig({
+ app: 'VUE',
+ webServer: sampleWebServer('VUE', {
+ command: 'npm run dev -- --port 5175 --strictPort',
+ env: {
+ VITE_THUNDERID_BASE_URL: process.env.SERVER_URL!,
+ VITE_THUNDERID_CLIENT_ID: sharedClientVariable('VUE_CLIENT_ID'),
+ },
+ }),
+});
+
+export default config;
diff --git a/tests/e2e/quickstarts/quickstart-vue-e2e/tests/change-credential.spec.ts b/tests/e2e/quickstarts/quickstart-vue-e2e/tests/change-credential.spec.ts
new file mode 100644
index 0000000..df37a2c
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-vue-e2e/tests/change-credential.spec.ts
@@ -0,0 +1,94 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * vue/quickstart - changing a credential (password) via the Account page's Security tab. See
+ * quickstart-react-e2e/tests/sign-in-out.spec.ts for prerequisites; identical shape, different app.
+ *
+ * Signs in as a dedicated credential-test user (see credentialTestUser in shared/apps.ts),
+ * distinct from the shared TEST_USER_USERNAME every sign-in-out spec uses: TC001 below changes
+ * this user's password and changes it back (see the `finally` block), and the suite runs
+ * `fullyParallel`, so mutating the shared user's password would race every other
+ * concurrently-running spec's login across every app. The two tests in this file are run
+ * serially (below) so they don't race each other over their own shared dedicated user either.
+ */
+
+import {credentialTestUser, SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {expect, test} from '../fixtures.ts';
+import {setUserPassword} from '../../../shared/utils/users-api/index.ts';
+
+const appUrl = sampleAppUrl(SampleApps.VUE);
+const {username, password} = credentialTestUser(SampleApps.VUE);
+// Derived from the real password rather than hardcoded, so this works regardless of what
+// policy the schema's password attribute is configured with in a given environment.
+const tempPassword = `${password}-Tmp1!`;
+
+test.describe.configure({mode: 'serial'});
+
+test.describe('vue/quickstart - Change credential', () => {
+ test.beforeEach(() => setUserPassword(username, password));
+
+ test('TC001: a password change via the Security tab takes effect and can be reverted', async ({
+ vueQuickstartPage,
+ }) => {
+ await vueQuickstartPage.goto(appUrl);
+ await vueQuickstartPage.verifyHomePageLoaded();
+ await vueQuickstartPage.clickSignInButton();
+ await vueQuickstartPage.verifyLoginPageLoaded();
+ await vueQuickstartPage.login(username, password);
+ await vueQuickstartPage.verifyLoggedIn();
+
+ await vueQuickstartPage.openSecurityTab();
+
+ try {
+ await vueQuickstartPage.changeCredential('Change password', tempPassword);
+
+ // Prove the change landed server-side, not just that the UI collapsed the form: sign
+ // out and back in using the new password.
+ await vueQuickstartPage.logout();
+ await vueQuickstartPage.verifyLoggedOut();
+
+ await vueQuickstartPage.clickSignInButton();
+ await vueQuickstartPage.verifyLoginPageLoaded();
+ await vueQuickstartPage.login(username, tempPassword);
+ await vueQuickstartPage.verifyLoggedIn();
+
+ await vueQuickstartPage.openSecurityTab();
+ } finally {
+ // Always attempt to restore the shared test user's original password, even if an
+ // assertion above failed.
+ await vueQuickstartPage.changeCredential('Change password', password);
+ }
+
+ // The restore itself also has to have actually worked, or the next test to sign in with
+ // the original password would fail.
+ await vueQuickstartPage.logout();
+ await vueQuickstartPage.verifyLoggedOut();
+ await vueQuickstartPage.clickSignInButton();
+ await vueQuickstartPage.verifyLoginPageLoaded();
+ await vueQuickstartPage.login(username, password);
+ await vueQuickstartPage.verifyLoggedIn();
+ });
+
+ test('TC002: the submit button stays disabled until the new value and confirmation match', async ({
+ vueQuickstartPage,
+ }) => {
+ await vueQuickstartPage.goto(appUrl);
+ await vueQuickstartPage.verifyHomePageLoaded();
+ await vueQuickstartPage.clickSignInButton();
+ await vueQuickstartPage.verifyLoginPageLoaded();
+ await vueQuickstartPage.login(username, password);
+ await vueQuickstartPage.verifyLoggedIn();
+
+ await vueQuickstartPage.openSecurityTab();
+ await vueQuickstartPage.toggleCredential('Change password');
+
+ expect(await vueQuickstartPage.isCredentialSubmitDisabled()).toBe(true);
+
+ await vueQuickstartPage.fillCredentialFields('mismatch-one', 'mismatch-two');
+ expect(await vueQuickstartPage.isCredentialSubmitDisabled()).toBe(true);
+
+ // Collapse without submitting - nothing was written, so there is nothing to restore.
+ await vueQuickstartPage.toggleCredential('Change password');
+ });
+});
diff --git a/tests/e2e/quickstarts/quickstart-vue-e2e/tests/sign-in-out.spec.ts b/tests/e2e/quickstarts/quickstart-vue-e2e/tests/sign-in-out.spec.ts
new file mode 100644
index 0000000..b9d41fb
--- /dev/null
+++ b/tests/e2e/quickstarts/quickstart-vue-e2e/tests/sign-in-out.spec.ts
@@ -0,0 +1,76 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * vue/quickstart - sign in and sign out via the redirect flow. See
+ * quickstart-react-e2e/tests/sign-in-out.spec.ts for prerequisites; identical shape, different app.
+ */
+
+import {SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {expect, test} from '../fixtures.ts';
+import {ProfileFieldLabels} from '../../../shared/pages/thunderid-web-sample.page.ts';
+import {decodeJwtPayload} from '../../../shared/utils/jwt/index.ts';
+
+const appUrl = sampleAppUrl(SampleApps.VUE);
+const username = process.env.TEST_USER_USERNAME!;
+const password = process.env.TEST_USER_PASSWORD!;
+
+test.describe('vue/quickstart - Sign in and Sign out', () => {
+ test('TC001: signs in with valid credentials', async ({vueQuickstartPage}) => {
+ await vueQuickstartPage.goto(appUrl);
+ await vueQuickstartPage.verifyHomePageLoaded();
+
+ await vueQuickstartPage.clickSignInButton();
+ await vueQuickstartPage.verifyLoginPageLoaded();
+
+ await vueQuickstartPage.login(username, password);
+ await vueQuickstartPage.verifyLoggedIn();
+ });
+
+ test('TC002: signs out after a successful sign-in', async ({vueQuickstartPage}) => {
+ await vueQuickstartPage.goto(appUrl);
+ await vueQuickstartPage.verifyHomePageLoaded();
+ await vueQuickstartPage.clickSignInButton();
+ await vueQuickstartPage.verifyLoginPageLoaded();
+ await vueQuickstartPage.login(username, password);
+ await vueQuickstartPage.verifyLoggedIn();
+
+ await vueQuickstartPage.logout();
+ await vueQuickstartPage.verifyLoggedOut();
+ });
+
+ test('TC003: token debug page displays a valid access token', async ({vueQuickstartPage}) => {
+ await vueQuickstartPage.goto(appUrl);
+ await vueQuickstartPage.verifyHomePageLoaded();
+ await vueQuickstartPage.clickSignInButton();
+ await vueQuickstartPage.verifyLoginPageLoaded();
+ await vueQuickstartPage.login(username, password);
+ await vueQuickstartPage.verifyLoggedIn();
+
+ await vueQuickstartPage.openTokenDebug();
+ await vueQuickstartPage.verifyTokenDebugLoaded();
+
+ const token = await vueQuickstartPage.getDisplayedAccessToken();
+ expect(token.split('.')).toHaveLength(3);
+
+ const payload = decodeJwtPayload(token);
+ expect(payload.sub).toBeTruthy();
+ expect(payload.exp as number).toBeGreaterThan(Math.floor(Date.now() / 1000));
+ });
+
+ test('TC004: profile changes made via Manage Profile are reflected', async ({vueQuickstartPage}) => {
+ await vueQuickstartPage.goto(appUrl);
+ await vueQuickstartPage.verifyHomePageLoaded();
+ await vueQuickstartPage.clickSignInButton();
+ await vueQuickstartPage.verifyLoginPageLoaded();
+ await vueQuickstartPage.login(username, password);
+ await vueQuickstartPage.verifyLoggedIn();
+
+ await vueQuickstartPage.openManageProfile();
+ await vueQuickstartPage.editProfileField(ProfileFieldLabels.givenName, 'Profile');
+ await vueQuickstartPage.editProfileField(ProfileFieldLabels.familyName, 'Updated');
+
+ await vueQuickstartPage.verifyProfileFieldValue(ProfileFieldLabels.givenName, 'Profile');
+ await vueQuickstartPage.verifyProfileFieldValue(ProfileFieldLabels.familyName, 'Updated');
+ });
+});
diff --git a/tests/e2e/self-service/myaccount-react-e2e/README.md b/tests/e2e/self-service/myaccount-react-e2e/README.md
new file mode 100644
index 0000000..ec13f92
--- /dev/null
+++ b/tests/e2e/self-service/myaccount-react-e2e/README.md
@@ -0,0 +1,20 @@
+# ThunderID Account Sample E2E
+
+Playwright suite for [`self-service/myaccount-react`](../../../../self-service/myaccount-react). It starts the sample from its own sources with its published SDK, signs in against a real ThunderID server, and checks:
+
+- A signed-in user lands on the account page
+- Profile edits on the Personal info tab are saved
+- A password change on the Security tab takes effect and can be reverted, and the form stays disabled until both values match
+- Sign-out
+
+## Run
+
+Start a ThunderID server first (see the [E2E README](../../README.md)), then, from `tests/e2e`:
+
+```bash
+npm ci
+npx playwright install chromium
+npm test -w self-service/myaccount-react-e2e
+```
+
+Playwright installs the sample with `npm ci` when it has no `node_modules`, and serves it on port 5177 with the OAuth2 client `SAMPLES_E2E_MYACCOUNT_REACT`. The global setup imports that client and creates the test users. Set `SAMPLES_ROOT` to run against another samples checkout, such as a `git archive` export.
diff --git a/tests/e2e/self-service/myaccount-react-e2e/fixtures.ts b/tests/e2e/self-service/myaccount-react-e2e/fixtures.ts
new file mode 100644
index 0000000..4e3b2c8
--- /dev/null
+++ b/tests/e2e/self-service/myaccount-react-e2e/fixtures.ts
@@ -0,0 +1,13 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {test as base} from '@playwright/test';
+import {MyAccountPage} from './pages/myaccount.page.ts';
+
+export const test = base.extend<{myAccountPage: MyAccountPage}>({
+ myAccountPage: async ({page}, use) => {
+ await use(new MyAccountPage(page));
+ },
+});
+
+export {expect} from '@playwright/test';
diff --git a/tests/e2e/self-service/myaccount-react-e2e/package.json b/tests/e2e/self-service/myaccount-react-e2e/package.json
new file mode 100644
index 0000000..2fd7c32
--- /dev/null
+++ b/tests/e2e/self-service/myaccount-react-e2e/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@thunderid/myaccount-react-e2e",
+ "private": true,
+ "version": "0.0.0",
+ "description": "E2E suite of self-service/myaccount-react",
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "1.64.1"
+ }
+}
diff --git a/tests/e2e/self-service/myaccount-react-e2e/pages/myaccount.page.ts b/tests/e2e/self-service/myaccount-react-e2e/pages/myaccount.page.ts
new file mode 100644
index 0000000..fab48c6
--- /dev/null
+++ b/tests/e2e/self-service/myaccount-react-e2e/pages/myaccount.page.ts
@@ -0,0 +1,33 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * self-service/myaccount-react Page Object. The account page has the same Home, Personal info and
+ * Security tabs as the quickstarts' Account page, so the shared page object drives it. What
+ * differs: the sign-in button is the SDK's default `SignInButton`, the dropdown's profile action
+ * is labelled "Account", and a signed-in user lands on /account straight away.
+ */
+
+import {type Locator, expect} from '@playwright/test';
+import {Timeouts} from '../../../shared/constants/timeouts.ts';
+import {ThunderIDAccountPageSamplePage} from '../../../shared/pages/thunderid-web-sample.page.ts';
+
+export class MyAccountPage extends ThunderIDAccountPageSamplePage {
+ protected manageAccountLabel: string | RegExp = /^Account$/;
+
+ protected signInButton(): Locator {
+ return this.page.getByRole('button', {name: /^sign in$/i}).first();
+ }
+
+ async goto(url: string): Promise {
+ await this.page.goto(url, {waitUntil: 'load'});
+ }
+
+ /** The greeting on the account page's Home tab, which a signed-in user lands on. */
+ async verifyAccountHome(): Promise {
+ await expect(this.page).toHaveURL(/\/account/, {timeout: Timeouts.REDIRECT});
+ await expect(this.page.getByRole('heading', {level: 2, name: /^Hi, /})).toBeVisible({
+ timeout: Timeouts.ELEMENT_VISIBILITY,
+ });
+ }
+}
diff --git a/tests/e2e/self-service/myaccount-react-e2e/playwright.config.ts b/tests/e2e/self-service/myaccount-react-e2e/playwright.config.ts
new file mode 100644
index 0000000..ba64d80
--- /dev/null
+++ b/tests/e2e/self-service/myaccount-react-e2e/playwright.config.ts
@@ -0,0 +1,18 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import {sharedClientVariable} from '../../shared/apps.ts';
+import {defineSampleConfig, sampleWebServer} from '../../shared/playwright.ts';
+
+const config = defineSampleConfig({
+ app: 'MYACCOUNT_REACT',
+ webServer: sampleWebServer('MYACCOUNT_REACT', {
+ command: 'npm run dev -- --port 5177 --strictPort',
+ env: {
+ VITE_THUNDERID_BASE_URL: process.env.SERVER_URL!,
+ VITE_THUNDERID_CLIENT_ID: sharedClientVariable('MYACCOUNT_REACT_CLIENT_ID'),
+ },
+ }),
+});
+
+export default config;
diff --git a/tests/e2e/self-service/myaccount-react-e2e/tests/change-credential.spec.ts b/tests/e2e/self-service/myaccount-react-e2e/tests/change-credential.spec.ts
new file mode 100644
index 0000000..c6e1614
--- /dev/null
+++ b/tests/e2e/self-service/myaccount-react-e2e/tests/change-credential.spec.ts
@@ -0,0 +1,92 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * self-service/myaccount-react - changing a credential (password) via the Account page's Security tab.
+ * See sign-in-out.spec.ts for the rest of the prerequisites.
+ *
+ * Signs in as a dedicated credential-test user (see credentialTestUser in shared/apps.ts),
+ * distinct from the shared TEST_USER_USERNAME every sign-in-out spec uses: TC001 below changes
+ * this user's password and changes it back (see the `finally` block), and the suite runs
+ * `fullyParallel`, so mutating the shared user's password would race every other
+ * concurrently-running spec's login across every app. The two tests in this file are run
+ * serially (below) so they don't race each other over their own shared dedicated user either.
+ */
+
+import {credentialTestUser, SampleApps, sampleAppUrl} from '../../../shared/apps.ts';
+import {expect, test} from '../fixtures.ts';
+import {setUserPassword} from '../../../shared/utils/users-api/index.ts';
+
+const appUrl = sampleAppUrl(SampleApps.MYACCOUNT_REACT);
+const {username, password} = credentialTestUser(SampleApps.MYACCOUNT_REACT);
+// Derived from the real password rather than hardcoded, so this works regardless of what
+// policy the schema's password attribute is configured with in a given environment.
+const tempPassword = `${password}-Tmp1!`;
+
+test.describe.configure({mode: 'serial'});
+
+test.describe('self-service/myaccount-react - Change credential', () => {
+ test.beforeEach(() => setUserPassword(username, password));
+
+ test('TC001: a password change via the Security tab takes effect and can be reverted', async ({myAccountPage}) => {
+ await myAccountPage.goto(appUrl);
+ await myAccountPage.verifyHomePageLoaded();
+ await myAccountPage.clickSignInButton();
+ await myAccountPage.verifyLoginPageLoaded();
+ await myAccountPage.login(username, password);
+ await myAccountPage.verifyLoggedIn();
+
+ await myAccountPage.openSecurityTab();
+
+ try {
+ await myAccountPage.changeCredential('Change password', tempPassword);
+
+ // Prove the change landed server-side, not just that the UI collapsed the form: sign
+ // out and back in using the new password.
+ await myAccountPage.logout();
+ await myAccountPage.verifyLoggedOut();
+
+ await myAccountPage.clickSignInButton();
+ await myAccountPage.verifyLoginPageLoaded();
+ await myAccountPage.login(username, tempPassword);
+ await myAccountPage.verifyLoggedIn();
+
+ await myAccountPage.openSecurityTab();
+ } finally {
+ // Always attempt to restore the shared test user's original password, even if an
+ // assertion above failed.
+ await myAccountPage.changeCredential('Change password', password);
+ }
+
+ // The restore itself also has to have actually worked, or the next test to sign in with
+ // the original password would fail.
+ await myAccountPage.logout();
+ await myAccountPage.verifyLoggedOut();
+ await myAccountPage.clickSignInButton();
+ await myAccountPage.verifyLoginPageLoaded();
+ await myAccountPage.login(username, password);
+ await myAccountPage.verifyLoggedIn();
+ });
+
+ test('TC002: the submit button stays disabled until the new value and confirmation match', async ({
+ myAccountPage,
+ }) => {
+ await myAccountPage.goto(appUrl);
+ await myAccountPage.verifyHomePageLoaded();
+ await myAccountPage.clickSignInButton();
+ await myAccountPage.verifyLoginPageLoaded();
+ await myAccountPage.login(username, password);
+ await myAccountPage.verifyLoggedIn();
+
+ await myAccountPage.openSecurityTab();
+ await myAccountPage.toggleCredential('Change password');
+
+ expect(await myAccountPage.isCredentialSubmitDisabled()).toBe(true);
+
+ await myAccountPage.fillCredentialFields('mismatch-one', 'mismatch-two');
+ expect(await myAccountPage.isCredentialSubmitDisabled()).toBe(true);
+
+ // Collapse without submitting - nothing was written, so there is nothing to restore.
+ await myAccountPage.toggleCredential('Change password');
+ });
+});
diff --git a/tests/e2e/self-service/myaccount-react-e2e/tests/sign-in-out.spec.ts b/tests/e2e/self-service/myaccount-react-e2e/tests/sign-in-out.spec.ts
new file mode 100644
index 0000000..880e71c
--- /dev/null
+++ b/tests/e2e/self-service/myaccount-react-e2e/tests/sign-in-out.spec.ts
@@ -0,0 +1,43 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * self-service/myaccount-react - sign in through the redirect flow, land on the account page,
+ * edit the profile, and sign out. Signs in as the shared test user (shared/apps.ts).
+ */
+
+import {SampleApps, sampleAppUrl, testUser} from '../../../shared/apps.ts';
+import {ProfileFieldLabels} from '../../../shared/pages/thunderid-web-sample.page.ts';
+import {test} from '../fixtures.ts';
+
+const appUrl = sampleAppUrl(SampleApps.MYACCOUNT_REACT);
+
+test.describe('self-service/myaccount-react - Sign in, profile and sign out', () => {
+ test.beforeEach(async ({myAccountPage}) => {
+ const {password, username} = testUser();
+ await myAccountPage.goto(appUrl);
+ await myAccountPage.verifyHomePageLoaded();
+ await myAccountPage.clickSignInButton();
+ await myAccountPage.verifyLoginPageLoaded();
+ await myAccountPage.login(username, password);
+ await myAccountPage.verifyLoggedIn();
+ });
+
+ test('TC001: a signed-in user lands on the account page', async ({myAccountPage}) => {
+ await myAccountPage.verifyAccountHome();
+ });
+
+ test('TC002: signs out after a successful sign-in', async ({myAccountPage}) => {
+ await myAccountPage.logout();
+ await myAccountPage.verifyLoggedOut();
+ });
+
+ test('TC003: profile changes made on the Personal info tab are saved', async ({myAccountPage}) => {
+ await myAccountPage.openManageProfile();
+ await myAccountPage.editProfileField(ProfileFieldLabels.givenName, 'Account');
+ await myAccountPage.editProfileField(ProfileFieldLabels.familyName, 'Edited');
+
+ await myAccountPage.verifyProfileFieldValue(ProfileFieldLabels.givenName, 'Account');
+ await myAccountPage.verifyProfileFieldValue(ProfileFieldLabels.familyName, 'Edited');
+ });
+});
diff --git a/tests/e2e/shared/apps.ts b/tests/e2e/shared/apps.ts
new file mode 100644
index 0000000..638b3c3
--- /dev/null
+++ b/tests/e2e/shared/apps.ts
@@ -0,0 +1,177 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * Sample App Registry
+ *
+ * One entry per web sample under E2E test: where it lives in the samples repository, the port its
+ * suite starts it on, and the declarative configs its global setup imports. Every port is distinct
+ * except where a sample's own config fixes it (see the README's port table), so most suites can
+ * run side by side against one server.
+ *
+ * The OAuth2 client IDs, secrets and redirect URIs live in thunderid-config/sample-apps.env (for
+ * the clients in sample-apps.yaml) or in the sample's own thunderid-config/thunderid.env (for the
+ * samples that ship one). Each suite's playwright.config.ts starts its app with matching values.
+ */
+
+import path from 'node:path';
+import {type ImportVariables, readEnvFile} from './utils/import-config/index.ts';
+
+/** tests/e2e */
+export const E2E_ROOT = path.resolve(import.meta.dirname, '..');
+
+/** The samples checkout the suites run against. Override with SAMPLES_ROOT, e.g. a `git archive` export. */
+export function samplesRoot(): string {
+ return path.resolve(process.env.SAMPLES_ROOT || path.resolve(E2E_ROOT, '../..'));
+}
+
+const SHARED_CONFIG = path.join(E2E_ROOT, 'shared/thunderid-config/sample-apps.yaml');
+const SHARED_ENV = path.join(E2E_ROOT, 'shared/thunderid-config/sample-apps.env');
+
+export interface ConfigImport {
+ /** Variables of a KEY=VALUE env file, applied first. */
+ envFile?: string;
+ /** The declarative config, relative to the sample's directory when `fromSample` is set. */
+ file: string;
+ fromSample?: boolean;
+ /** Variables that override the env file's, such as client secrets a sample ships empty. */
+ variables?: ImportVariables;
+}
+
+export interface SampleApp {
+ /** Imported in order by the suite's global setup. */
+ configs: ConfigImport[];
+ /** Whether the suite has a change-credential spec, which gets its own user. */
+ credentialUser?: boolean;
+ /** Short key, used for the dedicated credential-test user's name. */
+ key: string;
+ /** `/` in the samples repository. */
+ path: string;
+ /** The port the suite serves the app on. Unset for a sample with no browser UI. */
+ port?: number;
+ /**
+ * Names of server-wide settings (`server_config` documents) the sample's config sets. Setting
+ * E2E_SKIP_SERVER_CONFIGS=true leaves them out of the import, for a run against a shared server
+ * whose server-wide settings must stay as they are.
+ */
+ serverConfigs?: string[];
+}
+
+const shared: ConfigImport = {envFile: SHARED_ENV, file: SHARED_CONFIG};
+
+export const SampleApps = {
+ ADMIN_REACT: {configs: [shared], key: 'admin-react', path: 'management/admin-react', port: 5176},
+ BETTER_AUTH_NEXTJS: {
+ configs: [shared],
+ key: 'better-auth-nextjs',
+ path: 'integrations/better-auth-nextjs',
+ port: 3003,
+ },
+ BFF_REACT_EXPRESS: {configs: [shared], key: 'bff-react-express', path: 'patterns/bff-react-express', port: 5178},
+ BROWSER: {
+ configs: [shared],
+ credentialUser: true,
+ key: 'browser',
+ path: 'quickstarts/quickstart-browser',
+ port: 5173,
+ },
+ EXPRESS: {
+ configs: [shared],
+ credentialUser: true,
+ key: 'express',
+ path: 'quickstarts/quickstart-express',
+ port: 3000,
+ },
+ MYACCOUNT_REACT: {
+ configs: [shared],
+ credentialUser: true,
+ key: 'myaccount-react',
+ path: 'self-service/myaccount-react',
+ port: 5177,
+ },
+ NEXTJS: {configs: [shared], credentialUser: true, key: 'nextjs', path: 'quickstarts/quickstart-nextjs', port: 3001},
+ NEXTJS_B2B: {
+ configs: [
+ shared,
+ {
+ envFile: 'thunderid-config/thunderid.env',
+ file: 'thunderid-config/thunderid-config.yaml',
+ fromSample: true,
+ variables: {NEXTJS_B2B_CLIENT_SECRET: 'e2e-nextjs-b2b-secret'},
+ },
+ ],
+ key: 'nextjs-b2b',
+ path: 'quickstarts/quickstart-nextjs-b2b',
+ // Fixed by the redirect URIs in the sample's own config.
+ port: 3000,
+ serverConfigs: ['defaultResourceServer'],
+ },
+ NODE: {configs: [shared], key: 'node', path: 'quickstarts/quickstart-node'},
+ NUXT: {configs: [shared], credentialUser: true, key: 'nuxt', path: 'quickstarts/quickstart-nuxt', port: 3002},
+ REACT: {configs: [shared], credentialUser: true, key: 'react', path: 'quickstarts/quickstart-react', port: 5174},
+ REACT_B2B: {
+ configs: [
+ shared,
+ {envFile: 'thunderid-config/thunderid.env', file: 'thunderid-config/thunderid-config.yaml', fromSample: true},
+ ],
+ key: 'react-b2b',
+ path: 'quickstarts/quickstart-react-b2b',
+ // Fixed by the sample's vite.config.js (strictPort) and the redirect URIs in its own config.
+ port: 5173,
+ serverConfigs: ['defaultResourceServer'],
+ },
+ VUE: {configs: [shared], credentialUser: true, key: 'vue', path: 'quickstarts/quickstart-vue', port: 5175},
+ WAYFINDER_ENTERPRISE_NEXTJS: {
+ configs: [
+ shared,
+ {
+ envFile: 'thunderid-config/thunderid.env',
+ file: 'thunderid-config/thunderid-config.yaml',
+ fromSample: true,
+ variables: {
+ WAYFINDER_ENTERPRISE_BACKEND_CLIENT_SECRET: 'e2e-wayfinder-backend-secret',
+ WAYFINDER_ENTERPRISE_CLIENT_SECRET: 'e2e-wayfinder-secret',
+ },
+ },
+ ],
+ key: 'wayfinder-enterprise-nextjs',
+ path: 'b2b/wayfinder-enterprise-nextjs',
+ // Fixed by the sample's `next dev -p 3000` script.
+ port: 3000,
+ serverConfigs: ['defaultResourceServer'],
+ },
+} as const satisfies Record;
+
+export type SampleAppKey = keyof typeof SampleApps;
+
+/** The sample's directory under SAMPLES_ROOT. */
+export function sampleDir(app: SampleApp): string {
+ return path.join(samplesRoot(), app.path);
+}
+
+/** The base URL the suite serves the app on. */
+export function sampleAppUrl(app: SampleApp): string {
+ if (!app.port) throw new Error(`${app.path} has no browser UI`);
+ return `http://localhost:${app.port}`;
+}
+
+/** The shared user every sign-in spec signs in as. */
+export function testUser(): {password: string; username: string} {
+ return {password: process.env.TEST_USER_PASSWORD!, username: process.env.TEST_USER_USERNAME!};
+}
+
+/**
+ * The dedicated user of a suite's change-credential spec. Those specs change the signed-in user's
+ * password mid-test and change it back, so no other test may sign in as the same identity while
+ * they run. A function, not a constant: the env files load after this module is imported.
+ */
+export function credentialTestUser(app: SampleApp): {password: string; username: string} {
+ return {password: process.env.TEST_USER_PASSWORD!, username: `${process.env.TEST_USER_USERNAME}-cred-${app.key}`};
+}
+
+/** A variable of thunderid-config/sample-apps.env, such as REACT_CLIENT_ID. */
+export function sharedClientVariable(name: string): string {
+ const value = readEnvFile(SHARED_ENV)[name];
+ if (typeof value !== 'string') throw new Error(`sample-apps.env has no string ${name}`);
+ return value;
+}
diff --git a/tests/e2e/shared/constants/timeouts.ts b/tests/e2e/shared/constants/timeouts.ts
new file mode 100644
index 0000000..87aadfe
--- /dev/null
+++ b/tests/e2e/shared/constants/timeouts.ts
@@ -0,0 +1,22 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * Timeouts shared by every suite.
+ */
+export const Timeouts = {
+ /** Default timeout for UI actions (clicks, fills). */
+ DEFAULT_ACTION: 15000,
+
+ /** Timeout for checking element visibility. */
+ ELEMENT_VISIBILITY: 10000,
+
+ /** Timeout for a redirect-flow round trip (app -> gate -> app). */
+ REDIRECT: 20000,
+
+ /** Per-test timeout (see playwright.ts). */
+ GLOBAL_TEST: 60 * 1000,
+
+ /** How long Playwright waits for a sample app's dev server, including a first `npm ci`. */
+ WEB_SERVER: 5 * 60 * 1000,
+} as const;
diff --git a/tests/e2e/shared/defaults.env b/tests/e2e/shared/defaults.env
new file mode 100644
index 0000000..ac9739b
--- /dev/null
+++ b/tests/e2e/shared/defaults.env
@@ -0,0 +1,6 @@
+# Defaults for every suite. A real environment variable, or a tests/e2e/.env file, overrides them.
+SERVER_URL=https://localhost:8090
+ADMIN_USERNAME=admin
+ADMIN_PASSWORD=admin
+TEST_USER_USERNAME=e2e-test-user
+TEST_USER_PASSWORD=E2ePassword@123
diff --git a/tests/e2e/shared/env.ts b/tests/e2e/shared/env.ts
new file mode 100644
index 0000000..a2260d0
--- /dev/null
+++ b/tests/e2e/shared/env.ts
@@ -0,0 +1,15 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import path from 'node:path';
+import dotenv from 'dotenv';
+import {E2E_ROOT} from './apps.ts';
+
+/**
+ * Loads tests/e2e/.env (optional) and then shared/defaults.env. dotenv never overrides a variable
+ * that is already set, so the real environment wins, then .env, then the defaults.
+ */
+export function loadEnv(): void {
+ dotenv.config({path: path.join(E2E_ROOT, '.env'), quiet: true});
+ dotenv.config({path: path.join(E2E_ROOT, 'shared/defaults.env'), quiet: true});
+}
diff --git a/tests/e2e/shared/package.json b/tests/e2e/shared/package.json
new file mode 100644
index 0000000..509c1b7
--- /dev/null
+++ b/tests/e2e/shared/package.json
@@ -0,0 +1,12 @@
+{
+ "name": "@thunderid/samples-e2e-shared",
+ "private": true,
+ "version": "0.0.0",
+ "description": "What every sample app's E2E suite shares: the ThunderID server scripts, provisioning, and Playwright helpers",
+ "type": "module",
+ "dependencies": {
+ "@playwright/test": "1.64.1",
+ "dotenv": "17.2.3",
+ "undici": "7.30.1"
+ }
+}
diff --git a/tests/e2e/shared/pages/b2b-gate.page.ts b/tests/e2e/shared/pages/b2b-gate.page.ts
new file mode 100644
index 0000000..ac42f89
--- /dev/null
+++ b/tests/e2e/shared/pages/b2b-gate.page.ts
@@ -0,0 +1,86 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * B2B Gate Page Object
+ *
+ * The company sign-up and company picker that the B2B samples' own flows render on the ThunderID
+ * Gate (quickstart-react-b2b, quickstart-nextjs-b2b and wayfinder-enterprise-nextjs, each in its
+ * thunderid-config/thunderid-config.yaml). The prompts carry the same labels in all three, so one
+ * page object drives them.
+ */
+
+import {randomBytes} from 'node:crypto';
+import {expect} from '@playwright/test';
+import {Timeouts} from '../constants/timeouts.ts';
+import {GateLoginPage} from './gate-login.page.ts';
+
+export interface Company {
+ email: string;
+ handle: string;
+ name: string;
+ password: string;
+ username: string;
+}
+
+/** A company and first admin no earlier run has registered, so the flow's uniqueness checks pass. */
+export function newCompany(prefix: string): Company {
+ const id = `${Date.now().toString(36)}${randomBytes(2).toString('hex')}`;
+ return {
+ email: `${prefix}-${id}@example.com`,
+ handle: `${prefix}-${id}`,
+ name: `E2E ${prefix} ${id}`,
+ password: process.env.TEST_USER_PASSWORD ?? 'E2ePassword@123',
+ username: `${prefix}-admin-${id}`,
+ };
+}
+
+export class B2BGatePage extends GateLoginPage {
+ private async fill(label: string, value: string): Promise {
+ const input = this.page.getByLabel(label, {exact: false}).first();
+ await input.waitFor({state: 'visible', timeout: Timeouts.ELEMENT_VISIBILITY});
+ await input.fill(value);
+ }
+
+ private async click(name: string | RegExp): Promise {
+ const control = this.page.getByRole('button', {name}).or(this.page.getByRole('link', {name})).first();
+ await control.waitFor({state: 'visible', timeout: Timeouts.ELEMENT_VISIBILITY});
+ await control.click();
+ }
+
+ /**
+ * From the sign-in prompt, registers a company and its first admin. `accountChoice` is the
+ * button of the "where does your account live" step, for the flows that have one.
+ */
+ async registerCompany(company: Company, accountChoice?: string): Promise {
+ await this.verifyLoginPageLoaded();
+ await this.click('Register your company');
+ if (accountChoice) await this.click(accountChoice);
+
+ await this.fill('Username', company.username);
+ await this.fill('Work email', company.email);
+ await this.fill('Password', company.password);
+ await this.click(/^Continue$/);
+
+ await this.fill('Company name', company.name);
+ await this.fill('Organization handle', company.handle);
+ await this.click('Create company');
+
+ // The flows ask for the user type's remaining attributes only when a required one is missing.
+ const more = this.page.getByRole('button', {name: /^Continue$/});
+ if (await more.isVisible({timeout: 3000}).catch(() => false)) await more.click();
+ }
+
+ /** On the "Choose your company" prompt, picks a company by name and continues. */
+ async chooseCompany(name: string): Promise {
+ await expect(this.page.getByText('Choose your company')).toBeVisible({timeout: Timeouts.REDIRECT});
+ const select = this.page.getByLabel('Company').first();
+ if ((await select.evaluate((element) => element.tagName)) === 'SELECT') {
+ await select.selectOption({label: name});
+ } else {
+ await select.click();
+ await this.page.getByRole('option', {name}).click();
+ }
+ await this.click(/^Continue$/);
+ }
+}
diff --git a/tests/e2e/shared/pages/b2b-quickstart.page.ts b/tests/e2e/shared/pages/b2b-quickstart.page.ts
new file mode 100644
index 0000000..702a636
--- /dev/null
+++ b/tests/e2e/shared/pages/b2b-quickstart.page.ts
@@ -0,0 +1,58 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * B2B Quickstart Page Object, for quickstarts/quickstart-react-b2b and quickstarts/quickstart-nextjs-b2b,
+ * which render the same page: the hero's sign-in, the workspace that names the company the session
+ * signed in to, the access token claims it lists, and the header's `OrganizationUnitSwitcher`.
+ */
+
+import {expect} from '@playwright/test';
+import {Timeouts} from '../constants/timeouts.ts';
+import {B2BGatePage} from './b2b-gate.page.ts';
+
+export class B2BQuickstartPage extends B2BGatePage {
+ async goto(url: string): Promise {
+ // The Next.js sample renders on the server: wait for hydration, or the first click is lost.
+ await this.page.goto(url, {waitUntil: 'networkidle'});
+ }
+
+ async clickSignInButton(): Promise {
+ await this.page.getByRole('button', {name: 'Sign in or register a company'}).click();
+ }
+
+ async verifySignedInTo(companyName: string): Promise {
+ await expect(this.page.getByText(`Signed in to ${companyName}`)).toBeVisible({timeout: Timeouts.REDIRECT});
+ }
+
+ /** The value of one claim in the "Access token" section. */
+ async claim(name: string): Promise {
+ const value = this.page
+ .locator('dl.claims dt', {hasText: new RegExp(`^${name}$`)})
+ .locator('xpath=following-sibling::dd[1]');
+ await value.waitFor({state: 'visible', timeout: Timeouts.ELEMENT_VISIBILITY});
+ return (await value.innerText()).trim();
+ }
+
+ /** Switches the session to another company with the nav's organization unit switcher. */
+ async switchTo(currentName: string, targetName: string): Promise {
+ await this.page.locator('nav, header').getByRole('button', {name: currentName}).first().click();
+ await this.page
+ .getByRole('menuitem', {name: targetName})
+ .or(this.page.getByRole('option', {name: targetName}))
+ .or(this.page.getByRole('button', {name: targetName}))
+ .first()
+ .click();
+ }
+
+ async logout(): Promise {
+ await this.page.locator('nav, header').getByRole('button', {exact: true, name: 'Sign out'}).click();
+ await this.confirmSignOutIfPrompted();
+ }
+
+ async verifyLoggedOut(): Promise {
+ await expect(this.page.getByRole('button', {name: 'Sign in or register a company'})).toBeVisible({
+ timeout: Timeouts.REDIRECT,
+ });
+ }
+}
diff --git a/tests/e2e/shared/pages/base.page.ts b/tests/e2e/shared/pages/base.page.ts
new file mode 100644
index 0000000..72f0162
--- /dev/null
+++ b/tests/e2e/shared/pages/base.page.ts
@@ -0,0 +1,22 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import path from 'node:path';
+import type {Page} from '@playwright/test';
+
+/**
+ * Base Page Object, with a screenshot helper for debugging.
+ */
+export class BasePage {
+ readonly page: Page;
+
+ constructor(page: Page) {
+ this.page = page;
+ }
+
+ /** Saves a full-page screenshot under the suite's test-results/debug folder. */
+ async screenshot(name: string): Promise {
+ const screenshotPath = path.resolve(process.cwd(), 'test-results/debug', `${name}.png`);
+ await this.page.screenshot({fullPage: true, path: screenshotPath});
+ }
+}
diff --git a/tests/e2e/shared/pages/gate-login.page.ts b/tests/e2e/shared/pages/gate-login.page.ts
new file mode 100644
index 0000000..3a232d9
--- /dev/null
+++ b/tests/e2e/shared/pages/gate-login.page.ts
@@ -0,0 +1,73 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * Gate Login Page Object
+ *
+ * The OAuth authorization_code redirect flow always lands on ThunderID's shared "gate" app,
+ * which renders the login form and sign-out confirmation dynamically from the client
+ * application's auth flow. That DOM is identical regardless of which sample app (browser, react,
+ * vue, nextjs, nuxt, express) initiated the redirect, so the methods here are shared across every
+ * sample-app page object rather than duplicated per app. Only each app's own home-page chrome
+ * (its sign-in button, its post-login landing content) is app-specific and lives in the subclass.
+ *
+ * Modeled on thunder-id/thunderid tests/e2e/pages/gate-login.page.ts. Same gate, same DOM.
+ */
+
+import {Page, expect} from '@playwright/test';
+import {BasePage} from './base.page.ts';
+import {Timeouts} from '../constants/timeouts.ts';
+
+export class GateLoginPage extends BasePage {
+ constructor(page: Page) {
+ super(page);
+ }
+
+ async verifyLoginPageLoaded(): Promise {
+ await this.page.waitForSelector('input[name="username"], input[placeholder*="username" i]', {
+ state: 'visible',
+ timeout: Timeouts.ELEMENT_VISIBILITY,
+ });
+ }
+
+ async fillLoginForm(username: string, password: string): Promise {
+ const usernameInput = this.page.locator('input[name="username"], input[placeholder*="username" i]').first();
+ await usernameInput.waitFor({state: 'visible', timeout: Timeouts.DEFAULT_ACTION});
+ await usernameInput.fill(username);
+
+ const passwordInput = this.page.locator('input[name="password"], input[placeholder*="password" i]').first();
+ await passwordInput.waitFor({state: 'visible', timeout: Timeouts.DEFAULT_ACTION});
+ await passwordInput.fill(password);
+ }
+
+ async clickLogin(): Promise {
+ const loginButton = this.page
+ .locator('button[type="submit"], button:has-text("Sign In"), button:has-text("Sign in")')
+ .first();
+ await loginButton.waitFor({state: 'visible', timeout: Timeouts.DEFAULT_ACTION});
+ await loginButton.click();
+ }
+
+ /** Callers verify the result with their own signed-in check, so no wait beyond the click. */
+ async login(username: string, password: string): Promise {
+ await this.fillLoginForm(username, password);
+ await this.clickLogin();
+ }
+
+ /**
+ * Click through the gate's sign-out confirmation, if the app's sign-out button doesn't already
+ * complete RP-initiated logout in one step. Callers verify the result themselves.
+ */
+ async confirmSignOutIfPrompted(): Promise {
+ const confirmButton = this.page.getByRole('button', {exact: true, name: 'Sign out'});
+ const shown = await confirmButton
+ .waitFor({state: 'visible', timeout: Timeouts.DEFAULT_ACTION})
+ .then(() => true)
+ .catch(() => false);
+ if (shown) {
+ await confirmButton.click();
+ }
+ }
+}
+
+export {expect};
diff --git a/tests/e2e/shared/pages/thunderid-web-sample.page.ts b/tests/e2e/shared/pages/thunderid-web-sample.page.ts
new file mode 100644
index 0000000..efbafe7
--- /dev/null
+++ b/tests/e2e/shared/pages/thunderid-web-sample.page.ts
@@ -0,0 +1,276 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * ThunderID Web Sample Page Object
+ *
+ * react/quickstart, vue/quickstart, nextjs/quickstart, and nuxt/quickstart all render the same
+ * `@thunderid/{react,vue}`-family components with the same markup: a `button.btn-primary`
+ * "Sign in" CTA, and a `UserDropdown` trigger carrying either `data-testid=
+ * "thunderid-user-dropdown-trigger"` (react and, since it wraps react, nextjs) or the vendor-
+ * prefixed `user-dropdown__trigger` class (vue and, since it wraps vue, nuxt), see
+ * javascript-sdks packages/react/src/components/account/UserDropdown/BaseUserDropdown.tsx and
+ * packages/vue/src/components/account/user-dropdown/BaseUserDropdown.ts. One Page Object
+ * covers them all, and the BFF sample, which renders the React quickstart's pages; only the base URL differs.
+ */
+
+import {Locator, Page, expect} from '@playwright/test';
+import {GateLoginPage} from './gate-login.page.ts';
+import {Timeouts} from '../constants/timeouts.ts';
+
+const USER_DROPDOWN_TRIGGER =
+ 'button[data-testid="thunderid-user-dropdown-trigger"], button[class*="user-dropdown__trigger"]';
+
+/** Profile field labels, matching the schema's configured displayName, see
+ * editProfileField's doc comment. */
+export const ProfileFieldLabels = {
+ familyName: /^Last Name$/,
+ givenName: /^First Name$/,
+};
+
+export class ThunderIDWebSamplePage extends GateLoginPage {
+ constructor(page: Page) {
+ super(page);
+ }
+
+ async goto(url: string): Promise {
+ // 'load' alone isn't enough for nextjs/nuxt: both server-render this page, so the sign-in
+ // button is visible (and Playwright-clickable) before client-side hydration attaches its
+ // handler, making an early click a silent no-op. 'networkidle' waits out the trailing
+ // hydration-related requests (Nuxt DevTools, etc.) that follow the load event.
+ await this.page.goto(url, {waitUntil: 'networkidle'});
+ }
+
+ /** The sample's own "Sign in" call to action. A sample that renders the SDK's default
+ * `SignInButton` overrides this. */
+ protected signInButton(): Locator {
+ return this.page.locator('button.btn-primary', {hasText: 'Sign in'}).first();
+ }
+
+ async verifyHomePageLoaded(): Promise {
+ await expect(this.signInButton()).toBeVisible({timeout: Timeouts.ELEMENT_VISIBILITY});
+ }
+
+ async clickSignInButton(): Promise {
+ await this.signInButton().click();
+ }
+
+ async verifyLoggedIn(): Promise {
+ await expect(this.page.locator(USER_DROPDOWN_TRIGGER).first()).toBeVisible({timeout: Timeouts.REDIRECT});
+ }
+
+ async verifyLoggedOut(): Promise {
+ await this.verifyHomePageLoaded();
+ }
+
+ /** Non-throwing, immediate check for whether a session is currently active, unlike
+ * {@link verifyLoggedIn}, doesn't wait or assert. Used to recover a test's cleanup logic when
+ * an earlier step failed partway through a sign-out/sign-in cycle and it's unclear whether the
+ * page is currently authenticated. */
+ async isLoggedIn(): Promise {
+ return this.page.locator(USER_DROPDOWN_TRIGGER).first().isVisible();
+ }
+
+ /** Clicks the dropdown trigger and waits for `target` (a menu item scoped to the dropdown) to
+ * appear, re-clicking if it doesn't. The redirect landing page is server-rendered, so the
+ * trigger can be visible (and Playwright-clickable) before React/Vue finishes attaching its
+ * click handler, the click lands on plain markup and is silently lost, no error, nothing left
+ * to wait on. A second click after hydration catches up recovers cleanly; this has been
+ * observed to matter specifically for nuxt/quickstart under CI-level CPU contention, where the
+ * gap is wide enough to lose the first click outright rather than just render it late.
+ *
+ * Each click attempt is bounded by `DEFAULT_ACTION` (15 s) rather than the whole test timeout.
+ * Without that bound, a trigger that is visible but not yet actionable (e.g. covered during a
+ * Next.js SSR re-render after an OAuth redirect) would silently consume the entire remaining
+ * budget before failing; with it, the loop retries at most three times and surfaces a clear
+ * error if the trigger never becomes clickable. */
+ protected async openDropdown(target: Locator): Promise {
+ const trigger = this.page.locator(USER_DROPDOWN_TRIGGER).first();
+ // Fail fast before the loop if the trigger is absent outright (e.g. user not signed in).
+ await trigger.waitFor({state: 'visible', timeout: Timeouts.ELEMENT_VISIBILITY});
+ for (let attempt = 1; attempt <= 3; attempt++) {
+ try {
+ await trigger.click({timeout: Timeouts.DEFAULT_ACTION});
+ await expect(target).toBeVisible({timeout: 3000});
+ return;
+ } catch (error) {
+ if (attempt === 3) throw error;
+ // Brief pause before the next attempt - lets any transient animation or loading
+ // overlay settle so the click is more likely to land cleanly.
+ await this.page.waitForTimeout(500);
+ }
+ }
+ }
+
+ async logout(): Promise {
+ const signOutButton = this.page.getByRole('button', {name: 'Sign Out'});
+ await this.openDropdown(signOutButton);
+ await signOutButton.click();
+ await this.confirmSignOutIfPrompted();
+ }
+
+ /** Opens the token debug page via the "Token debug" menu item each sample adds to
+ * `UserDropdown`'s `menuItems` prop. React/Next.js render it as a real `/token` link; Vue/Nuxt
+ * wire it to an `onClick` page-switch instead (no real navigation), so this matches on text
+ * rather than a specific role. */
+ async openTokenDebug(): Promise {
+ const tokenDebugItem = this.page.getByText('Token debug', {exact: true});
+ await this.openDropdown(tokenDebugItem);
+ await tokenDebugItem.click();
+ }
+
+ async verifyTokenDebugLoaded(): Promise {
+ await expect(this.page.locator('.token-raw')).toBeVisible({timeout: Timeouts.ELEMENT_VISIBILITY});
+ }
+
+ /** Reads the raw access token JWT rendered across the three .token-part--* spans, the same
+ * class names browser/quickstart's own hand-written token.js uses, since every sample's
+ * TokenDebugPage is its own component, not part of the shared UI library. */
+ async getDisplayedAccessToken(): Promise {
+ const raw = this.page.locator('.token-raw');
+ await raw.waitFor({state: 'visible', timeout: Timeouts.ELEMENT_VISIBILITY});
+ const header = await raw.locator('.token-part--header').innerText();
+ const payload = await raw.locator('.token-part--payload').innerText();
+ const signature = await raw.locator('.token-part--signature').innerText();
+ return `${header}.${payload}.${signature}`;
+ }
+
+ /** Opens the SDK-provided profile dialog, `UserDropdown`'s built-in profile action, under the
+ * plain "Profile" label. Nuxt inherits this via its own `UserDropdown` wrapper, which delegates
+ * to the same `@thunderid/vue` component; nextjs likewise inherits React's "Manage Profile"
+ * label and behavior. Every quickstart's own Nav component now overrides this action to
+ * redirect to a full Account page instead, see {@link ThunderIDAccountPageSamplePage} below
+ * for their variant of the methods in this section. */
+ async openManageProfile(): Promise {
+ const profileButton = this.page.getByRole('button', {name: /^(Manage Profile|Profile)$/});
+ await this.openDropdown(profileButton);
+ await profileButton.click();
+ await expect(this.page.getByRole('dialog')).toBeVisible({timeout: Timeouts.ELEMENT_VISIBILITY});
+ }
+
+ /** Edits one field of the profile form, which renders each attribute as its own row with an
+ * "Edit" button that reveals an inline input plus row-scoped Save/Cancel buttons (not one big
+ * form with a single submit), see javascript-sdks packages/react/.../BaseUserProfile.tsx and its Vue
+ * equivalent. `label` matches the schema attribute's configured displayName (e.g. "First
+ * Name"), which BaseUserProfile renders once it receives the app's `userSchema` (fetched from
+ * `/users/me/meta`). */
+ async editProfileField(label: RegExp, value: string): Promise {
+ const row = this.page.getByRole('dialog').getByText(label).locator('../..');
+ await row.getByRole('button', {name: 'Edit'}).click();
+ await row.locator('input').fill(value);
+ await row.getByRole('button', {name: 'Save'}).click();
+ await expect(row.locator('input')).toHaveCount(0, {timeout: Timeouts.DEFAULT_ACTION});
+ }
+
+ async closeManageProfile(): Promise {
+ await this.page.getByRole('dialog').getByRole('button', {name: 'Close'}).click();
+ }
+
+ /** Verifies a field's row reverted from edit mode back to display mode showing the just-saved
+ * value, checked in place rather than via the dropdown trigger or homepage, since whether
+ * those pick up the change without a session refresh isn't guaranteed. */
+ async verifyProfileFieldValue(label: RegExp, value: string): Promise {
+ const row = this.page.getByRole('dialog').getByText(label).locator('../..');
+ await expect(row).toContainText(value, {timeout: Timeouts.ELEMENT_VISIBILITY});
+ }
+}
+
+/**
+ * Variant of {@link ThunderIDWebSamplePage} for every quickstart (react, vue, nextjs, nuxt),
+ * whose Nav components redirect `UserDropdown`'s profile action to a full "Manage Account" page
+ * (Home / Personal info / Security tabs) instead of opening the SDK's built-in profile popup.
+ * Kept as a subclass rather than folded into the shared base since the base class's dialog-based
+ * behavior remains independently correct and testable (it's what the SDK components fall back to
+ * when an app doesn't override `onManageProfile`, e.g. `browser/quickstart`).
+ */
+export class ThunderIDAccountPageSamplePage extends ThunderIDWebSamplePage {
+ /** The label of `UserDropdown`'s profile action, which the sample sets with `manageProfileLabel`. */
+ protected manageAccountLabel: string | RegExp = 'Manage Account';
+
+ /** Opens the Account page via the nav dropdown's profile action. Lands on the Home tab, same as
+ * the sidebar's own default. */
+ protected async openManageAccount(): Promise {
+ const manageAccountButton = this.page.getByRole('button', {name: this.manageAccountLabel});
+ await this.openDropdown(manageAccountButton);
+ await manageAccountButton.click();
+ }
+
+ /** Opens the Account page and switches to its Personal info tab. */
+ async openManageProfile(): Promise {
+ await this.openManageAccount();
+
+ const sidebar = this.page.getByRole('navigation');
+ await sidebar.getByRole('button', {name: 'Personal info'}).click();
+ await expect(this.page.getByRole('heading', {name: 'Personal info', level: 2})).toBeVisible({
+ timeout: Timeouts.ELEMENT_VISIBILITY,
+ });
+ }
+
+ /** Opens the Account page and switches to its Security tab, where each credential
+ * (`ChangeCredential`) renders as a collapsed row that expands into the real form, see
+ * {@link changeCredential}. */
+ async openSecurityTab(): Promise {
+ await this.openManageAccount();
+
+ const sidebar = this.page.getByRole('navigation');
+ await sidebar.getByRole('button', {name: 'Security'}).click();
+ await expect(this.page.getByRole('heading', {name: 'Security', level: 2})).toBeVisible({
+ timeout: Timeouts.ELEMENT_VISIBILITY,
+ });
+ }
+
+ /** Expands or collapses the named credential's row (`cta` is the row's own toggle button
+ * text, e.g. "Change password"), the same button does both. Call {@link openSecurityTab}
+ * first. */
+ async toggleCredential(cta: string): Promise {
+ await this.page.getByRole('button', {name: cta}).click();
+ }
+
+ /** Fills the currently-open credential form's new-value and confirmation fields, without
+ * submitting. */
+ async fillCredentialFields(newValue: string, confirmValue: string): Promise {
+ await this.page.locator('input[name="newPassword"]').fill(newValue);
+ await this.page.locator('input[name="confirmPassword"]').fill(confirmValue);
+ }
+
+ /** Whether the currently-open credential form's submit button is disabled. */
+ async isCredentialSubmitDisabled(): Promise {
+ return this.page.getByRole('button', {name: /^Update /}).isDisabled();
+ }
+
+ /** Expands the named credential's row, fills the new value and its confirmation, and
+ * submits. Waits for the row to collapse back afterward, `ChangeCredential`'s `onSuccess`
+ * closes it in this sample, so that collapse is this method's proof the write actually
+ * succeeded server-side rather than just that the button was clicked. Call
+ * {@link openSecurityTab} first. */
+ async changeCredential(cta: string, newValue: string): Promise {
+ const toggle = this.page.getByRole('button', {name: cta});
+ // Bounded wait before the click: if the caller's page state doesn't actually have this row
+ // (e.g. the Security tab isn't open), fail fast with a clear "not visible" error instead of
+ // hanging on Playwright's default click-actionability wait, which is effectively bounded
+ // only by the whole test's timeout.
+ await expect(toggle).toBeVisible({timeout: Timeouts.ELEMENT_VISIBILITY});
+ await toggle.click();
+
+ await this.fillCredentialFields(newValue, newValue);
+ await this.page.getByRole('button', {name: /^Update /}).click();
+
+ await expect(toggle).toHaveAttribute('aria-expanded', 'false', {timeout: Timeouts.ELEMENT_VISIBILITY});
+ }
+
+ /** Same row structure as the base class's dialog variant (`BaseUserProfile` is unchanged -
+ * only where it's mounted changed), scoped to the page's `` landmark instead of a
+ * dialog. */
+ async editProfileField(label: RegExp, value: string): Promise {
+ const row = this.page.getByRole('main').getByText(label).locator('../..');
+ await row.getByRole('button', {name: 'Edit'}).click();
+ await row.locator('input').fill(value);
+ await row.getByRole('button', {name: 'Save'}).click();
+ await expect(row.locator('input')).toHaveCount(0, {timeout: Timeouts.DEFAULT_ACTION});
+ }
+
+ async verifyProfileFieldValue(label: RegExp, value: string): Promise {
+ const row = this.page.getByRole('main').getByText(label).locator('../..');
+ await expect(row).toContainText(value, {timeout: Timeouts.ELEMENT_VISIBILITY});
+ }
+}
diff --git a/tests/e2e/shared/playwright.ts b/tests/e2e/shared/playwright.ts
new file mode 100644
index 0000000..5ccfc6e
--- /dev/null
+++ b/tests/e2e/shared/playwright.ts
@@ -0,0 +1,90 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * The Playwright config every web suite shares. A suite's playwright.config.ts names its app and
+ * how to start it; this fills in the rest.
+ */
+
+import path from 'node:path';
+import {type PlaywrightTestConfig, defineConfig, devices} from '@playwright/test';
+import {E2E_ROOT, SampleApps, type SampleAppKey, sampleAppUrl, sampleDir} from './apps.ts';
+import {Timeouts} from './constants/timeouts.ts';
+import {loadEnv} from './env.ts';
+
+// At import time, so a suite's playwright.config.ts can read SERVER_URL and the like.
+loadEnv();
+
+type WebServer = NonNullable>;
+
+export interface SampleWebServerOptions {
+ /** The sample's own start command, such as `npm run dev -- --port 5174`. */
+ command: string;
+ /** Run the command here instead of the sample's root, relative to it. */
+ cwd?: string;
+ /** Skip the install step, for a second server of a sample a first one already installed. */
+ skipInstall?: boolean;
+ /** Environment of the app: its client ID, server URL and the like, in place of a .env file. */
+ env?: Record;
+ /** A port to wait for instead of a URL, for a server whose URLs all need a session or a header. */
+ port?: number;
+ /** What to poll until the app is up. Defaults to the app's URL. */
+ url?: string;
+}
+
+/**
+ * Starts the sample with its own start command, after installing it from its lockfile when it has
+ * no node_modules yet. The app's configuration comes through the environment, so nothing is
+ * written into the sample's directory.
+ */
+export function sampleWebServer(key: SampleAppKey, options: SampleWebServerOptions): WebServer {
+ const app = SampleApps[key];
+ const ensureInstalled = path.join(E2E_ROOT, 'shared/scripts/ensure-installed.mjs');
+ return {
+ command: options.skipInstall ? options.command : `node "${ensureInstalled}" && ${options.command}`,
+ cwd: path.join(sampleDir(app), options.cwd ?? ''),
+ env: options.env ?? {},
+ // A port already taken by something else fails the run, unless E2E_REUSE_SERVER=true says the
+ // app is already running there.
+ reuseExistingServer: process.env.E2E_REUSE_SERVER === 'true',
+ stderr: 'pipe',
+ stdout: process.env.E2E_APP_LOGS === 'true' ? 'pipe' : 'ignore',
+ timeout: Timeouts.WEB_SERVER,
+ ...(options.port ? {port: options.port} : {url: options.url ?? sampleAppUrl(app)}),
+ };
+}
+
+export interface SampleConfigOptions {
+ app: SampleAppKey;
+ /** Extra options merged over the defaults, such as a longer per-test timeout. */
+ overrides?: PlaywrightTestConfig;
+ webServer?: WebServer | WebServer[];
+}
+
+export function defineSampleConfig({app, overrides, webServer}: SampleConfigOptions): PlaywrightTestConfig {
+ return defineConfig({
+ testDir: './tests',
+ // Tests in one file run in order (Playwright's default); files run in parallel.
+ fullyParallel: true,
+ forbidOnly: !!process.env.CI,
+ retries: process.env.CI ? 1 : 0,
+ // Kept low on purpose: ThunderID's SQLite store can answer concurrent authorization code
+ // exchanges with SQLITE_BUSY ("Invalid authorization code"). E2E_WORKERS raises it.
+ workers: Number(process.env.E2E_WORKERS) || 2,
+ reporter: [['list'], ['html', {open: 'never'}]],
+ globalSetup: path.join(E2E_ROOT, 'shared/setup/global-setup.ts'),
+ metadata: {app},
+ timeout: Timeouts.GLOBAL_TEST,
+ use: {
+ ignoreHTTPSErrors: true,
+ screenshot: 'only-on-failure',
+ trace: 'retain-on-failure',
+ video: 'retain-on-failure',
+ },
+ projects: [{name: 'chromium', use: {...devices['Desktop Chrome']}}],
+ webServer,
+ ...overrides,
+ });
+}
+
+export {devices};
diff --git a/tests/e2e/shared/scripts/ensure-installed.mjs b/tests/e2e/shared/scripts/ensure-installed.mjs
new file mode 100644
index 0000000..ad5c114
--- /dev/null
+++ b/tests/e2e/shared/scripts/ensure-installed.mjs
@@ -0,0 +1,16 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * Runs `npm ci` in the current directory (a sample app) when it has no node_modules yet, so a
+ * suite can start the sample straight from a fresh checkout or `git archive` export. The sample
+ * installs from its own lockfile, so it runs the published SDK release it pins.
+ */
+
+import {execFileSync} from 'node:child_process';
+import fs from 'node:fs';
+
+if (!fs.existsSync('node_modules')) {
+ console.log(`Installing ${process.cwd()} with npm ci...`);
+ execFileSync('npm', ['ci', '--no-audit', '--no-fund'], {shell: process.platform === 'win32', stdio: 'inherit'});
+}
diff --git a/tests/e2e/shared/scripts/mobile.sh b/tests/e2e/shared/scripts/mobile.sh
new file mode 100755
index 0000000..98b0dc0
--- /dev/null
+++ b/tests/e2e/shared/scripts/mobile.sh
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+# Copyright 2026 The ThunderID Authors
+# SPDX-License-Identifier: Apache-2.0
+#
+# Helpers the mobile suites' run-e2e.sh scripts source. They expect THUNDERID (the path to
+# thunderid.sh), SCRIPT_DIR, SERVER_URL, E2E_USER, E2E_PASS and the maestro_args array to be set.
+
+# Starts or reuses the server, imports the sample's own application config, re-applies
+# attestation devMode, and makes sure the test user exists.
+provision_mobile_app() {
+ local config_file="$1" app_id="$2"
+ "$THUNDERID" start
+ "$THUNDERID" import "$config_file"
+
+ # POST /import drops the attestation block (see the note in the config), so without this the
+ # app stores attestation: null and /flow/execute rejects the sample with FES-1016.
+ if [ -n "$app_id" ]; then
+ echo "==> Re-applying attestation devMode over PUT (import drops it)"
+ local token app_json put_resp
+ token=$("$THUNDERID" token)
+ app_json=$(curl -sk "$SERVER_URL/applications/$app_id" -H "Authorization: Bearer $token")
+ put_resp=$(jq '.attestation = {devMode: true}' <<<"$app_json" |
+ curl -sk -X PUT "$SERVER_URL/applications/$app_id" \
+ -H "Authorization: Bearer $token" -H "Content-Type: application/json" -d @-)
+ if [ "$(jq -r '.attestation.devMode // false' <<<"$put_resp")" != "true" ]; then
+ echo "ERROR: attestation devMode did not persist. Response: $put_resp" >&2
+ exit 1
+ fi
+ fi
+
+ "$THUNDERID" ensure-user "$E2E_USER" "$E2E_PASS"
+}
+
+# Resolves a booted iOS Simulator into SIM_UDID, booting one if necessary. Which iPhone models
+# exist depends on the installed Xcode, so prefer SIMULATOR_NAME but fall back to any iPhone.
+resolve_simulator() {
+ local uuid="[0-9A-F]{8}-([0-9A-F]{4}-){3}[0-9A-F]{12}"
+ SIM_UDID=$(xcrun simctl list devices booted | grep -oE "$uuid" | head -1 || true)
+ if [ -n "$SIM_UDID" ]; then
+ echo "==> Using the booted simulator $SIM_UDID"
+ return 0
+ fi
+ local wanted="${SIMULATOR_NAME:-iPhone 17}"
+ SIM_UDID=$(xcrun simctl list devices available | grep -m1 "$wanted (" | grep -oE "$uuid" || true)
+ if [ -z "$SIM_UDID" ]; then
+ SIM_UDID=$(xcrun simctl list devices available | grep -m1 -E "^[[:space:]]+iPhone " | grep -oE "$uuid" || true)
+ fi
+ if [ -z "$SIM_UDID" ]; then
+ echo "ERROR: no available iPhone simulator." >&2
+ exit 1
+ fi
+ echo "==> Booting simulator $SIM_UDID"
+ xcrun simctl boot "$SIM_UDID"
+ xcrun simctl bootstatus "$SIM_UDID" -b
+}
+
+# Runs the suite's flows (or the flows passed as arguments) with Maestro and writes a JUnit report.
+# Arguments select the device, such as `--device ` or `--platform android`.
+run_flows() {
+ command -v maestro >/dev/null 2>&1 || {
+ echo "ERROR: maestro is not installed. See https://maestro.mobile.dev/getting-started/installing-maestro" >&2
+ exit 1
+ }
+ # Check the length before expanding: under `set -u`, bash 3.2 (the macOS default) treats an
+ # empty array expansion as an unbound variable.
+ local target
+ if [ "${#maestro_args[@]}" -eq 0 ]; then
+ target=("flows/")
+ else
+ target=("${maestro_args[@]}")
+ fi
+ echo "==> Running Maestro"
+ (cd "$SCRIPT_DIR" && maestro "$@" test "${target[@]}" \
+ --format=JUNIT \
+ --output=report.xml \
+ -e E2E_USERNAME="$E2E_USER" \
+ -e E2E_PASSWORD="$E2E_PASS")
+}
diff --git a/tests/e2e/shared/scripts/thunderid.sh b/tests/e2e/shared/scripts/thunderid.sh
new file mode 100755
index 0000000..9bc6817
--- /dev/null
+++ b/tests/e2e/shared/scripts/thunderid.sh
@@ -0,0 +1,318 @@
+#!/usr/bin/env bash
+# Copyright 2026 The ThunderID Authors
+# SPDX-License-Identifier: Apache-2.0
+#
+# thunderid.sh: the ThunderID server plumbing every E2E suite in this repository shares, the web
+# (Playwright) suites in CI and the mobile (Maestro) suites locally.
+#
+# Usage:
+# thunderid.sh start Download the latest release (or THUNDERID_VERSION), set
+# it up and start it. Reuses a server already serving.
+# thunderid.sh stop Stop the server this script started.
+# thunderid.sh restart Stop, then start the installed release again. Some
+# server configs, such as CORS, apply on start.
+# thunderid.sh wait Wait until the server answers its liveness check.
+# thunderid.sh token Print an admin access token.
+# thunderid.sh import [env-file] POST /import a declarative config, with the variables
+# of a KEY=VALUE env file (a JSON array value stays an
+# array). Upserts, so re-running is safe.
+# thunderid.sh ensure-user Create a Person user unless the username exists.
+#
+# Environment:
+# SERVER_URL Where the server is reachable (default https://localhost:8090)
+# ADMIN_USERNAME Admin user (default admin)
+# ADMIN_PASSWORD Admin password (default admin)
+# ADMIN_TOKEN Reuse this admin token instead of minting one
+# THUNDERID_VERSION Release to run, without the leading "v" (default: latest release)
+# INSTALL_DIR Where to unpack the release (default tests/e2e/.thunderid-server)
+# GITHUB_TOKEN Optional. Authenticates the latest-release lookup against the API rate limit
+#
+# Why not `npx thunderid`? It renders an interactive TUI that needs a terminal, which a CI runner
+# does not have. The release's own setup.sh and start.sh take the same arguments without one.
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+E2E_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
+
+SERVER_URL="${SERVER_URL:-https://localhost:8090}"
+ADMIN_USER="${ADMIN_USERNAME:-admin}"
+ADMIN_PASS="${ADMIN_PASSWORD:-admin}"
+INSTALL_DIR="${INSTALL_DIR:-$E2E_ROOT/.thunderid-server}"
+
+require() {
+ local tool
+ for tool in "$@"; do
+ command -v "$tool" >/dev/null 2>&1 || { echo "ERROR: $tool is required but not installed." >&2; exit 1; }
+ done
+}
+
+is_up() {
+ curl -sk -o /dev/null --max-time 3 -f "$SERVER_URL/health/liveness" 2>/dev/null
+}
+
+wait_for_server() {
+ echo "==> Waiting for $SERVER_URL" >&2
+ local i
+ for i in $(seq 1 120); do
+ if is_up; then
+ echo " up" >&2
+ return 0
+ fi
+ sleep 2
+ done
+ echo "ERROR: the server did not come up within 240s." >&2
+ [ -f "$INSTALL_DIR/server.log" ] && tail -50 "$INSTALL_DIR/server.log" >&2
+ exit 1
+}
+
+# The installed release, recorded by `start` so `restart` and `stop` find it again.
+dist_home() {
+ cat "$INSTALL_DIR/dist-home" 2>/dev/null || true
+}
+
+launch() {
+ local home="$1"
+ echo "==> Starting the server from $home" >&2
+ # The server has to outlive the step that starts it, which means leaving this process group.
+ # setsid does that but does not exist on macOS, so fall back to Python, whose
+ # start_new_session flag calls setsid in the child.
+ if command -v setsid >/dev/null 2>&1; then
+ (cd "$home" && setsid ./start.sh >>"$INSTALL_DIR/server.log" 2>&1 A server is already serving at $SERVER_URL, reusing it" >&2
+ return 0
+ fi
+ require curl jq unzip
+
+ local pkg_os pkg_arch
+ case "$(uname -s)" in
+ Darwin) pkg_os="macos" ;;
+ Linux) pkg_os="linux" ;;
+ *) echo "ERROR: unsupported OS $(uname -s)." >&2; exit 1 ;;
+ esac
+ case "$(uname -m)" in
+ arm64 | aarch64) pkg_arch="arm64" ;;
+ x86_64 | amd64) pkg_arch="x64" ;;
+ *) echo "ERROR: unsupported architecture $(uname -m)." >&2; exit 1 ;;
+ esac
+
+ local version="${THUNDERID_VERSION:-}"
+ if [ -z "$version" ]; then
+ echo "==> Resolving the latest ThunderID release" >&2
+ local auth=()
+ [ -n "${GITHUB_TOKEN:-}" ] && auth=(-H "Authorization: Bearer $GITHUB_TOKEN")
+ version=$(curl -sSL ${auth[@]+"${auth[@]}"} https://api.github.com/repos/thunder-id/thunderid/releases/latest |
+ jq -r '.tag_name // empty' | sed 's/^v//')
+ if [ -z "$version" ]; then
+ echo "ERROR: could not resolve the latest release (rate limited?). Set THUNDERID_VERSION." >&2
+ exit 1
+ fi
+ fi
+
+ local name="thunderid-${version}-${pkg_os}-${pkg_arch}"
+ local home="$INSTALL_DIR/$name"
+ mkdir -p "$INSTALL_DIR"
+ if [ ! -d "$home" ]; then
+ echo "==> Downloading $name.zip" >&2
+ local attempt
+ # The release download from GitHub occasionally fails with a transient 5xx.
+ for attempt in 1 2 3; do
+ curl -sSLf "https://github.com/thunder-id/thunderid/releases/download/v${version}/${name}.zip" \
+ -o "$INSTALL_DIR/$name.zip" && break
+ [ "$attempt" = 3 ] && { echo "ERROR: download failed." >&2; exit 1; }
+ sleep 15
+ done
+ unzip -q "$INSTALL_DIR/$name.zip" -d "$INSTALL_DIR"
+ rm -f "$INSTALL_DIR/$name.zip"
+
+ echo "==> Running first-time setup" >&2
+ (cd "$home" && chmod +x setup.sh start.sh &&
+ ./setup.sh --admin-username "$ADMIN_USER" --admin-password "$ADMIN_PASS")
+ fi
+ echo "$home" >"$INSTALL_DIR/dist-home"
+ launch "$home"
+}
+
+stop_server() {
+ local port
+ port=$(sed -E 's#^[a-z]+://[^:/]+:?([0-9]*).*#\1#' <<<"$SERVER_URL")
+ port="${port:-443}"
+ if [ -z "$(dist_home)" ]; then
+ echo "ERROR: no server started by this script under $INSTALL_DIR; not stopping $SERVER_URL." >&2
+ exit 1
+ fi
+ echo "==> Stopping the server on port $port" >&2
+ # start.sh runs the server binary as a separate process, so stop whatever holds the port.
+ lsof -ti "tcp:$port" -sTCP:LISTEN | xargs kill 2>/dev/null || true
+ local i
+ for i in $(seq 1 30); do
+ is_up || return 0
+ sleep 1
+ done
+ lsof -ti "tcp:$port" -sTCP:LISTEN | xargs kill -9 2>/dev/null || true
+}
+
+restart_server() {
+ local home
+ home=$(dist_home)
+ [ -n "$home" ] || { echo "ERROR: run '$0 start' first." >&2; exit 1; }
+ stop_server
+ launch "$home"
+}
+
+# Mints an admin token through the CONSOLE application: authorization code with PKCE, whose
+# credentials step runs over the Flow Execution API. Mirrors utils/authentication in this folder.
+mint_admin_token() {
+ if [ -n "${ADMIN_TOKEN:-}" ]; then
+ echo "$ADMIN_TOKEN"
+ return 0
+ fi
+ require curl jq openssl
+
+ local redirect_uri="$SERVER_URL/console"
+ local verifier challenge
+ verifier=$(openssl rand -hex 32 | cut -c1-43)
+ challenge=$(printf '%s' "$verifier" | openssl dgst -sha256 -binary | openssl base64 -A | tr '+/' '-_' | tr -d '=')
+
+ local headers_file location auth_id exec_id
+ headers_file=$(mktemp)
+ curl -sk -o /dev/null -D "$headers_file" \
+ -G "$SERVER_URL/oauth2/authorize" \
+ --data-urlencode "client_id=CONSOLE" \
+ --data-urlencode "redirect_uri=$redirect_uri" \
+ --data-urlencode "scope=system" \
+ --data-urlencode "resource=$SERVER_URL/mcp" \
+ --data-urlencode "response_type=code" \
+ --data-urlencode "code_challenge=$challenge" \
+ --data-urlencode "code_challenge_method=S256"
+ location=$(grep -i "^location:" "$headers_file" | tr -d '\r' | sed 's/^[Ll]ocation: //' || true)
+ rm -f "$headers_file"
+ auth_id=$(sed -n 's/.*[?&]authId=\([^&]*\).*/\1/p' <<<"$location")
+ exec_id=$(sed -n 's/.*[?&]executionId=\([^&]*\).*/\1/p' <<<"$location")
+ if [ -z "$auth_id" ] || [ -z "$exec_id" ]; then
+ echo "ERROR: could not parse authId/executionId from the authorize redirect: $location" >&2
+ exit 1
+ fi
+
+ # The console sign-in flow runs an SSO check before the credentials prompt: the first call
+ # advances past it and mints a challenge token, the second submits the credentials with it.
+ local prompt_resp challenge_token flow_resp assertion
+ prompt_resp=$(curl -sk -X POST "$SERVER_URL/flow/execute" \
+ -H "Content-Type: application/json" -d "{\"executionId\": \"$exec_id\"}")
+ challenge_token=$(jq -r '.challengeToken // empty' <<<"$prompt_resp")
+ [ -n "$challenge_token" ] || { echo "ERROR: no challenge token: $prompt_resp" >&2; exit 1; }
+
+ flow_resp=$(curl -sk -X POST "$SERVER_URL/flow/execute" \
+ -H "Content-Type: application/json" \
+ -d "$(jq -n --arg e "$exec_id" --arg c "$challenge_token" --arg u "$ADMIN_USER" --arg p "$ADMIN_PASS" \
+ '{executionId: $e, challengeToken: $c, action: "action_001", inputs: {username: $u, password: $p}}')")
+ assertion=$(jq -r '.assertion // empty' <<<"$flow_resp")
+ [ -n "$assertion" ] || { echo "ERROR: admin sign-in returned no assertion: $flow_resp" >&2; exit 1; }
+
+ local callback_resp auth_code token_resp token
+ callback_resp=$(curl -sk -X POST "$SERVER_URL/oauth2/auth/callback" \
+ -H "Content-Type: application/json" -d "{\"authId\": \"$auth_id\", \"assertion\": \"$assertion\"}")
+ auth_code=$(jq -r '.redirect_uri // empty' <<<"$callback_resp" | sed -n 's/.*[?&]code=\([^&]*\).*/\1/p')
+ [ -n "$auth_code" ] || { echo "ERROR: callback returned no authorization code: $callback_resp" >&2; exit 1; }
+
+ token_resp=$(curl -sk -X POST "$SERVER_URL/oauth2/token" \
+ -H "Content-Type: application/x-www-form-urlencoded" \
+ --data-urlencode "grant_type=authorization_code" \
+ --data-urlencode "code=$auth_code" \
+ --data-urlencode "redirect_uri=$redirect_uri" \
+ --data-urlencode "client_id=CONSOLE" \
+ --data-urlencode "resource=$SERVER_URL/mcp" \
+ --data-urlencode "code_verifier=$verifier")
+ token=$(jq -r '.access_token // empty' <<<"$token_resp")
+ [ -n "$token" ] || { echo "ERROR: token endpoint returned no access token: $token_resp" >&2; exit 1; }
+ echo "$token"
+}
+
+# Reads a KEY=VALUE env file into a JSON object. A value that parses as a JSON array stays one, so
+# a list variable such as REDIRECT_URIS=["http://localhost:3000"] reaches the template as a list.
+env_file_to_json() {
+ local file="$1"
+ if [ -z "$file" ]; then
+ echo '{}'
+ return 0
+ fi
+ grep -E '^[A-Za-z_][A-Za-z0-9_]*=' "$file" | jq -R -n '
+ [inputs | capture("^(?[^=]+)=(?.*)$")
+ | .v as $v | {key: .k, value: (try ($v | fromjson | select(type == "array")) catch $v // $v)}]
+ | from_entries'
+}
+
+import_config() {
+ local yaml="$1" env_file="${2:-}"
+ require curl jq
+ [ -f "$yaml" ] || { echo "ERROR: no config at $yaml" >&2; exit 1; }
+ local token variables response status
+ token=$(mint_admin_token)
+ variables=$(env_file_to_json "$env_file")
+ echo "==> Importing $yaml" >&2
+ response=$(mktemp)
+ status=$(jq -n --rawfile content "$yaml" --argjson variables "$variables" \
+ '{content: $content, variables: $variables, options: {upsert: true}}' |
+ curl -sk -o "$response" -w "%{http_code}" -X POST "$SERVER_URL/import" \
+ -H "Authorization: Bearer $token" -H "Content-Type: application/json" -d @-)
+ if [ "$status" != "200" ] || [ "$(jq -r '.summary.failed // 1' "$response")" != "0" ]; then
+ echo "ERROR: import of $yaml failed (HTTP $status):" >&2
+ cat "$response" >&2
+ rm -f "$response"
+ exit 1
+ fi
+ rm -f "$response"
+}
+
+ensure_user() {
+ local username="$1" password="$2"
+ require curl jq
+ local token filter existing ou_id created
+ token=$(mint_admin_token)
+ # The filter grammar accepts exactly one `attribute eq "value"` clause.
+ filter=$(printf 'username eq "%s"' "$username" | jq -sRr @uri)
+ existing=$(curl -sk "$SERVER_URL/users?filter=$filter" -H "Authorization: Bearer $token")
+ if [ "$(jq -r '(.users // []) | length' <<<"$existing")" -gt 0 ]; then
+ echo "==> User '$username' already exists" >&2
+ return 0
+ fi
+ ou_id=$(curl -sk "$SERVER_URL/user-types?limit=100" -H "Authorization: Bearer $token" |
+ jq -r '.types[] | select(.name == "Person") | .ouId')
+ [ -n "$ou_id" ] && [ "$ou_id" != "null" ] || { echo "ERROR: no Person user type." >&2; exit 1; }
+ created=$(curl -sk -X POST "$SERVER_URL/users" \
+ -H "Authorization: Bearer $token" -H "Content-Type: application/json" \
+ -d "$(jq -n --arg u "$username" --arg p "$password" --arg ou "$ou_id" \
+ '{ouId: $ou, type: "Person", attributes: {username: $u, password: $p,
+ email: ($u + "@example.com"), given_name: "E2E", family_name: "User"}}')")
+ [ -n "$(jq -r '.id // empty' <<<"$created")" ] || { echo "ERROR: user creation failed: $created" >&2; exit 1; }
+ echo "==> Created user '$username'" >&2
+}
+
+case "${1:-}" in
+ start) start_server ;;
+ stop) stop_server ;;
+ restart) restart_server ;;
+ wait) wait_for_server ;;
+ token) mint_admin_token ;;
+ import) [ $# -ge 2 ] || { echo "usage: $0 import [env-file]" >&2; exit 2; }; import_config "$2" "${3:-}" ;;
+ ensure-user) [ $# -eq 3 ] || { echo "usage: $0 ensure-user " >&2; exit 2; }; ensure_user "$2" "$3" ;;
+ *) sed -n '5,30p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 2 ;;
+esac
diff --git a/tests/e2e/shared/setup/global-setup.ts b/tests/e2e/shared/setup/global-setup.ts
new file mode 100644
index 0000000..8a9eaf7
--- /dev/null
+++ b/tests/e2e/shared/setup/global-setup.ts
@@ -0,0 +1,30 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * Global setup of every web suite. The suite's playwright.config.ts names its app in
+ * `metadata.app` (see playwright.ts), and this provisions the server for it.
+ *
+ * There is no global teardown: the test users and imported resources stay on the server, so
+ * suites that run side by side never delete what another one still uses, and the next run
+ * reuses them.
+ */
+
+import type {FullConfig} from '@playwright/test';
+import {SampleApps, type SampleAppKey} from '../apps.ts';
+import {loadEnv} from '../env.ts';
+import {getAdminToken} from '../utils/authentication/index.ts';
+import {provision} from './provision.ts';
+
+export default async function globalSetup(config: FullConfig): Promise {
+ loadEnv();
+ const key = config.metadata.app as SampleAppKey;
+ const app = SampleApps[key];
+ if (!app) {
+ throw new Error(`playwright.config.ts names no known app in metadata.app (got "${String(key)}")`);
+ }
+ await provision(app);
+ // Workers inherit the runner's environment, so they reuse this token instead of each signing
+ // the admin in again.
+ process.env.ADMIN_TOKEN ??= await getAdminToken();
+}
diff --git a/tests/e2e/shared/setup/provision.ts b/tests/e2e/shared/setup/provision.ts
new file mode 100644
index 0000000..307fa21
--- /dev/null
+++ b/tests/e2e/shared/setup/provision.ts
@@ -0,0 +1,44 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * Puts the server in the state a suite needs: imports the app's declarative configs and makes sure
+ * the test users exist with their known passwords. Every step upserts, so it runs the same against
+ * a fresh CI server and against a local server a previous run (or the javascript-sdks suite)
+ * already provisioned.
+ */
+
+import fs from 'node:fs';
+import path from 'node:path';
+import {type SampleApp, credentialTestUser, sampleDir, testUser} from '../apps.ts';
+import {type ImportVariables, importConfig, readEnvFile, withoutServerConfigs} from '../utils/import-config/index.ts';
+import {ensureUser} from '../utils/users-api/index.ts';
+
+export async function provision(app: SampleApp): Promise {
+ const skipServerConfigs = process.env.E2E_SKIP_SERVER_CONFIGS === 'true' ? (app.serverConfigs ?? []) : [];
+
+ for (const config of app.configs) {
+ const base = config.fromSample ? sampleDir(app) : '';
+ const file = path.resolve(base, config.file);
+ let variables: ImportVariables = {};
+ if (config.envFile) variables = readEnvFile(path.resolve(base, config.envFile));
+ variables = {...variables, ...config.variables};
+
+ const content = withoutServerConfigs(fs.readFileSync(file, 'utf8'), skipServerConfigs);
+ console.log(`Importing ${path.relative(process.cwd(), file)}`);
+ await importConfig(content, variables);
+ }
+ if (skipServerConfigs.length > 0) {
+ console.log(`Left out server configs (E2E_SKIP_SERVER_CONFIGS): ${skipServerConfigs.join(', ')}`);
+ }
+
+ const user = testUser();
+ await ensureUser(user.username, user.password);
+ console.log(`Test user ready: ${user.username}`);
+
+ if (app.credentialUser) {
+ const credUser = credentialTestUser(app);
+ await ensureUser(credUser.username, credUser.password, 'Credential Test');
+ console.log(`Credential test user ready: ${credUser.username}`);
+ }
+}
diff --git a/tests/e2e/shared/thunderid-config/sample-apps.env b/tests/e2e/shared/thunderid-config/sample-apps.env
new file mode 100644
index 0000000..f70b722
--- /dev/null
+++ b/tests/e2e/shared/thunderid-config/sample-apps.env
@@ -0,0 +1,35 @@
+# Variables of sample-apps.yaml. A value that is a JSON array reaches the template as a list.
+# The ports and client IDs must match shared/apps.ts, which starts each app with them.
+# Test-only client secrets: these clients exist only on a disposable E2E server.
+BROWSER_CLIENT_ID=JS_SDK_E2E_BROWSER
+BROWSER_REDIRECT_URIS=["http://localhost:5173"]
+REACT_CLIENT_ID=JS_SDK_E2E_REACT
+REACT_REDIRECT_URIS=["http://localhost:5174"]
+VUE_CLIENT_ID=JS_SDK_E2E_VUE
+VUE_REDIRECT_URIS=["http://localhost:5175"]
+NEXTJS_CLIENT_ID=JS_SDK_E2E_NEXTJS
+NEXTJS_CLIENT_SECRET=e2e-nextjs-secret
+NEXTJS_REDIRECT_URIS=["http://localhost:3001"]
+NUXT_CLIENT_ID=JS_SDK_E2E_NUXT
+NUXT_CLIENT_SECRET=e2e-nuxt-secret
+NUXT_REDIRECT_URIS=["http://localhost:3002/api/auth/callback"]
+NUXT_POST_LOGOUT_REDIRECT_URIS=["http://localhost:3002/"]
+EXPRESS_CLIENT_ID=JS_SDK_E2E_EXPRESS
+EXPRESS_CLIENT_SECRET=e2e-express-secret
+EXPRESS_REDIRECT_URIS=["http://localhost:3000/login"]
+EXPRESS_POST_LOGOUT_REDIRECT_URIS=["http://localhost:3000/logout"]
+NODE_CLIENT_ID=JS_SDK_E2E_NODE
+NODE_CLIENT_SECRET=e2e-node-secret
+ADMIN_REACT_CLIENT_ID=SAMPLES_E2E_ADMIN_REACT
+ADMIN_REACT_REDIRECT_URIS=["http://localhost:5176"]
+MYACCOUNT_REACT_CLIENT_ID=SAMPLES_E2E_MYACCOUNT_REACT
+MYACCOUNT_REACT_REDIRECT_URIS=["http://localhost:5177"]
+BFF_REACT_EXPRESS_CLIENT_ID=SAMPLES_E2E_BFF_REACT_EXPRESS
+BFF_REACT_EXPRESS_CLIENT_SECRET=e2e-bff-react-express-secret
+BFF_REACT_EXPRESS_REDIRECT_URIS=["http://localhost:5178/api/auth/callback"]
+BFF_REACT_EXPRESS_POST_LOGOUT_REDIRECT_URIS=["http://localhost:5178"]
+BETTER_AUTH_NEXTJS_CLIENT_ID=SAMPLES_E2E_BETTER_AUTH_NEXTJS
+BETTER_AUTH_NEXTJS_CLIENT_SECRET=e2e-better-auth-nextjs-secret
+BETTER_AUTH_NEXTJS_REDIRECT_URIS=["http://localhost:3003/api/auth/callback/thunderid"]
+BETTER_AUTH_NEXTJS_POST_LOGOUT_REDIRECT_URIS=["http://localhost:3003"]
+ALL_ORIGINS=["http://localhost:5173","http://localhost:5174","http://localhost:5175","http://localhost:5176","http://localhost:5177","http://localhost:5178","http://localhost:3000","http://localhost:3001","http://localhost:3002","http://localhost:3003"]
diff --git a/tests/e2e/shared/thunderid-config/sample-apps.yaml b/tests/e2e/shared/thunderid-config/sample-apps.yaml
new file mode 100644
index 0000000..17b9ab1
--- /dev/null
+++ b/tests/e2e/shared/thunderid-config/sample-apps.yaml
@@ -0,0 +1,549 @@
+# Copyright 2026 The ThunderID Authors
+# SPDX-License-Identifier: Apache-2.0
+#
+# Declarative OAuth2 application registrations for the web sample apps under E2E test that do not
+# ship a declarative config of their own, imported with `POST /import` by every web suite's global
+# setup (shared/setup/global-setup.ts) and by `thunderid.sh import`. The quickstart clients keep the
+# `JS_SDK_E2E_*` IDs the javascript-sdks E2E suite registers, so both suites can share one server.
+# The B2B samples (quickstart-react-b2b, quickstart-nextjs-b2b, wayfinder-enterprise-nextjs) import
+# their own thunderid-config/thunderid-config.yaml instead.
+#
+# The trailing server config is the CORS allowlist of every browser app's origin. An import
+# replaces the whole list, so it names every app, not only the one a suite tests.
+#
+# Double-brace placeholders below are filled from the `variables` map passed alongside this file's
+# content. shared/apps.ts holds the values, and the port and redirect URIs each app runs with.
+#
+# Note: this whole file is parsed as a Go template, comments included. Never write a literal
+# double-brace placeholder in prose here, even in a comment, or the import fails.
+
+---
+resource_type: application
+id: 019a0000-0000-7000-8000-0000000000b1
+ouHandle: default
+name: E2E browser/quickstart
+description: OAuth2 client for the browser SDK quickstart's E2E suite
+type: browser
+authFlowHandle: default-flow
+isRegistrationFlowEnabled: false
+isRecoveryFlowEnabled: false
+isSignOutFlowEnabled: false
+assertion:
+ validityPeriod: 3600
+loginConsent:
+ validityPeriod: 0
+allowedUserTypes:
+ - Person
+inboundAuthConfig:
+ - type: oauth2
+ config:
+ clientId: "{{.BROWSER_CLIENT_ID}}"
+ redirectUris:
+ {{- range .BROWSER_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ postLogoutRedirectUris:
+ {{- range .BROWSER_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ grantTypes:
+ - authorization_code
+ responseTypes:
+ - code
+ tokenEndpointAuthMethod: none
+ pkceRequired: true
+ publicClient: true
+ token:
+ accessToken:
+ userConfig:
+ validityPeriod: 3600
+ attributes: [given_name, family_name, email]
+ idToken:
+ validityPeriod: 3600
+ userAttributes: [given_name, family_name, email]
+ responseType: JWT
+ userInfo:
+ responseType: JSON
+ userAttributes: [given_name, family_name, email]
+
+---
+resource_type: application
+id: 019a0000-0000-7000-8000-0000000000b2
+ouHandle: default
+name: E2E react/quickstart
+description: OAuth2 client for the React SDK quickstart's E2E suite
+type: browser
+authFlowHandle: default-flow
+isRegistrationFlowEnabled: false
+isRecoveryFlowEnabled: false
+isSignOutFlowEnabled: false
+assertion:
+ validityPeriod: 3600
+loginConsent:
+ validityPeriod: 0
+allowedUserTypes:
+ - Person
+inboundAuthConfig:
+ - type: oauth2
+ config:
+ clientId: "{{.REACT_CLIENT_ID}}"
+ redirectUris:
+ {{- range .REACT_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ postLogoutRedirectUris:
+ {{- range .REACT_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ grantTypes:
+ - authorization_code
+ responseTypes:
+ - code
+ tokenEndpointAuthMethod: none
+ pkceRequired: true
+ publicClient: true
+ token:
+ accessToken:
+ userConfig:
+ validityPeriod: 3600
+ attributes: [given_name, family_name, email]
+ idToken:
+ validityPeriod: 3600
+ userAttributes: [given_name, family_name, email]
+ responseType: JWT
+ userInfo:
+ responseType: JSON
+ userAttributes: [given_name, family_name, email]
+
+---
+resource_type: application
+id: 019a0000-0000-7000-8000-0000000000b3
+ouHandle: default
+name: E2E vue/quickstart
+description: OAuth2 client for the Vue SDK quickstart's E2E suite
+type: browser
+authFlowHandle: default-flow
+isRegistrationFlowEnabled: false
+isRecoveryFlowEnabled: false
+isSignOutFlowEnabled: false
+assertion:
+ validityPeriod: 3600
+loginConsent:
+ validityPeriod: 0
+allowedUserTypes:
+ - Person
+inboundAuthConfig:
+ - type: oauth2
+ config:
+ clientId: "{{.VUE_CLIENT_ID}}"
+ redirectUris:
+ {{- range .VUE_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ postLogoutRedirectUris:
+ {{- range .VUE_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ grantTypes:
+ - authorization_code
+ responseTypes:
+ - code
+ tokenEndpointAuthMethod: none
+ pkceRequired: true
+ publicClient: true
+ token:
+ accessToken:
+ userConfig:
+ validityPeriod: 3600
+ attributes: [given_name, family_name, email]
+ idToken:
+ validityPeriod: 3600
+ userAttributes: [given_name, family_name, email]
+ responseType: JWT
+ userInfo:
+ responseType: JSON
+ userAttributes: [given_name, family_name, email]
+
+---
+resource_type: application
+id: 019a0000-0000-7000-8000-0000000000b4
+ouHandle: default
+name: E2E nextjs/quickstart
+description: OAuth2 client for the Next.js SDK quickstart's E2E suite (redirect flow)
+type: browser
+authFlowHandle: default-flow
+isRegistrationFlowEnabled: false
+isRecoveryFlowEnabled: false
+isSignOutFlowEnabled: false
+assertion:
+ validityPeriod: 3600
+loginConsent:
+ validityPeriod: 0
+allowedUserTypes:
+ - Person
+inboundAuthConfig:
+ - type: oauth2
+ config:
+ clientId: "{{.NEXTJS_CLIENT_ID}}"
+ clientSecret: "{{.NEXTJS_CLIENT_SECRET}}"
+ redirectUris:
+ {{- range .NEXTJS_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ postLogoutRedirectUris:
+ {{- range .NEXTJS_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ grantTypes:
+ - authorization_code
+ responseTypes:
+ - code
+ tokenEndpointAuthMethod: client_secret_basic
+ pkceRequired: true
+ publicClient: false
+ token:
+ accessToken:
+ userConfig:
+ validityPeriod: 3600
+ attributes: [given_name, family_name, email]
+ idToken:
+ validityPeriod: 3600
+ userAttributes: [given_name, family_name, email]
+ responseType: JWT
+ userInfo:
+ responseType: JSON
+ userAttributes: [given_name, family_name, email]
+
+---
+resource_type: application
+id: 019a0000-0000-7000-8000-0000000000b5
+ouHandle: default
+name: E2E nuxt/quickstart
+description: OAuth2 client for the Nuxt SDK quickstart's E2E suite (redirect flow)
+type: browser
+authFlowHandle: default-flow
+isRegistrationFlowEnabled: false
+isRecoveryFlowEnabled: false
+isSignOutFlowEnabled: false
+assertion:
+ validityPeriod: 3600
+loginConsent:
+ validityPeriod: 0
+allowedUserTypes:
+ - Person
+inboundAuthConfig:
+ - type: oauth2
+ config:
+ clientId: "{{.NUXT_CLIENT_ID}}"
+ clientSecret: "{{.NUXT_CLIENT_SECRET}}"
+ redirectUris:
+ {{- range .NUXT_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ postLogoutRedirectUris:
+ {{- range .NUXT_POST_LOGOUT_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ grantTypes:
+ - authorization_code
+ responseTypes:
+ - code
+ tokenEndpointAuthMethod: client_secret_basic
+ pkceRequired: true
+ publicClient: false
+ token:
+ accessToken:
+ userConfig:
+ validityPeriod: 3600
+ attributes: [given_name, family_name, email]
+ idToken:
+ validityPeriod: 3600
+ userAttributes: [given_name, family_name, email]
+ responseType: JWT
+ userInfo:
+ responseType: JSON
+ userAttributes: [given_name, family_name, email]
+
+---
+resource_type: application
+id: 019a0000-0000-7000-8000-0000000000b6
+ouHandle: default
+name: E2E express/quickstart
+description: OAuth2 client for the Express SDK quickstart's E2E suite
+type: browser
+authFlowHandle: default-flow
+isRegistrationFlowEnabled: false
+isRecoveryFlowEnabled: false
+isSignOutFlowEnabled: false
+assertion:
+ validityPeriod: 3600
+loginConsent:
+ validityPeriod: 0
+allowedUserTypes:
+ - Person
+inboundAuthConfig:
+ - type: oauth2
+ config:
+ clientId: "{{.EXPRESS_CLIENT_ID}}"
+ clientSecret: "{{.EXPRESS_CLIENT_SECRET}}"
+ redirectUris:
+ {{- range .EXPRESS_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ postLogoutRedirectUris:
+ {{- range .EXPRESS_POST_LOGOUT_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ grantTypes:
+ - authorization_code
+ responseTypes:
+ - code
+ tokenEndpointAuthMethod: client_secret_basic
+ pkceRequired: true
+ publicClient: false
+ token:
+ accessToken:
+ userConfig:
+ validityPeriod: 3600
+ attributes: [given_name, family_name, email]
+ idToken:
+ validityPeriod: 3600
+ userAttributes: [given_name, family_name, email]
+ responseType: JWT
+ userInfo:
+ responseType: JSON
+ userAttributes: [given_name, family_name, email]
+
+---
+resource_type: application
+id: 019a0000-0000-7000-8000-0000000000b7
+ouHandle: default
+name: E2E node/quickstart
+description: OAuth2 client for the Node SDK quickstart's E2E suite (client_credentials, no browser UI)
+type: fullstack
+authFlowHandle: default-flow
+isRegistrationFlowEnabled: false
+isRecoveryFlowEnabled: false
+isSignOutFlowEnabled: false
+inboundAuthConfig:
+ - type: oauth2
+ config:
+ clientId: "{{.NODE_CLIENT_ID}}"
+ clientSecret: "{{.NODE_CLIENT_SECRET}}"
+ grantTypes:
+ - client_credentials
+ tokenEndpointAuthMethod: client_secret_basic
+ pkceRequired: false
+ publicClient: false
+
+---
+resource_type: application
+id: 019a0000-0000-7000-8000-0000000000c1
+ouHandle: default
+name: E2E management/admin-react
+description: OAuth2 client for the admin-react sample's E2E suite
+type: browser
+authFlowHandle: default-flow
+isRegistrationFlowEnabled: false
+isRecoveryFlowEnabled: false
+isSignOutFlowEnabled: false
+assertion:
+ validityPeriod: 3600
+loginConsent:
+ validityPeriod: 0
+allowedUserTypes:
+ - Person
+inboundAuthConfig:
+ - type: oauth2
+ config:
+ clientId: "{{.ADMIN_REACT_CLIENT_ID}}"
+ redirectUris:
+ {{- range .ADMIN_REACT_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ postLogoutRedirectUris:
+ {{- range .ADMIN_REACT_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ grantTypes:
+ - authorization_code
+ - refresh_token
+ responseTypes:
+ - code
+ tokenEndpointAuthMethod: none
+ pkceRequired: true
+ publicClient: true
+ token:
+ accessToken:
+ userConfig:
+ validityPeriod: 3600
+ attributes: [given_name, family_name, email]
+ idToken:
+ validityPeriod: 3600
+ userAttributes: [given_name, family_name, email]
+ responseType: JWT
+ userInfo:
+ responseType: JSON
+ userAttributes: [given_name, family_name, email]
+
+---
+resource_type: application
+id: 019a0000-0000-7000-8000-0000000000c2
+ouHandle: default
+name: E2E self-service/myaccount-react
+description: OAuth2 client for the myaccount-react sample's E2E suite
+type: browser
+authFlowHandle: default-flow
+isRegistrationFlowEnabled: false
+isRecoveryFlowEnabled: false
+isSignOutFlowEnabled: false
+assertion:
+ validityPeriod: 3600
+loginConsent:
+ validityPeriod: 0
+allowedUserTypes:
+ - Person
+inboundAuthConfig:
+ - type: oauth2
+ config:
+ clientId: "{{.MYACCOUNT_REACT_CLIENT_ID}}"
+ redirectUris:
+ {{- range .MYACCOUNT_REACT_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ postLogoutRedirectUris:
+ {{- range .MYACCOUNT_REACT_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ grantTypes:
+ - authorization_code
+ - refresh_token
+ responseTypes:
+ - code
+ tokenEndpointAuthMethod: none
+ pkceRequired: true
+ publicClient: true
+ token:
+ accessToken:
+ userConfig:
+ validityPeriod: 3600
+ attributes: [given_name, family_name, email]
+ idToken:
+ validityPeriod: 3600
+ userAttributes: [given_name, family_name, email]
+ responseType: JWT
+ userInfo:
+ responseType: JSON
+ userAttributes: [given_name, family_name, email]
+
+---
+resource_type: application
+id: 019a0000-0000-7000-8000-0000000000c3
+ouHandle: default
+name: E2E patterns/bff-react-express
+description: OAuth2 client of the BFF in the bff-react-express sample's E2E suite
+type: browser
+authFlowHandle: default-flow
+isRegistrationFlowEnabled: false
+isRecoveryFlowEnabled: false
+isSignOutFlowEnabled: false
+assertion:
+ validityPeriod: 3600
+loginConsent:
+ validityPeriod: 0
+allowedUserTypes:
+ - Person
+inboundAuthConfig:
+ - type: oauth2
+ config:
+ clientId: "{{.BFF_REACT_EXPRESS_CLIENT_ID}}"
+ clientSecret: "{{.BFF_REACT_EXPRESS_CLIENT_SECRET}}"
+ redirectUris:
+ {{- range .BFF_REACT_EXPRESS_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ postLogoutRedirectUris:
+ {{- range .BFF_REACT_EXPRESS_POST_LOGOUT_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ grantTypes:
+ - authorization_code
+ - refresh_token
+ responseTypes:
+ - code
+ tokenEndpointAuthMethod: client_secret_basic
+ pkceRequired: true
+ publicClient: false
+ token:
+ accessToken:
+ userConfig:
+ validityPeriod: 3600
+ attributes: [given_name, family_name, email]
+ idToken:
+ validityPeriod: 3600
+ userAttributes: [given_name, family_name, email]
+ responseType: JWT
+ userInfo:
+ responseType: JSON
+ userAttributes: [given_name, family_name, email]
+
+---
+resource_type: application
+id: 019a0000-0000-7000-8000-0000000000c4
+ouHandle: default
+name: E2E integrations/better-auth-nextjs
+description: OAuth2 client for the better-auth-nextjs sample's E2E suite
+type: browser
+authFlowHandle: default-flow
+isRegistrationFlowEnabled: false
+isRecoveryFlowEnabled: false
+isSignOutFlowEnabled: false
+assertion:
+ validityPeriod: 3600
+loginConsent:
+ validityPeriod: 0
+allowedUserTypes:
+ - Person
+inboundAuthConfig:
+ - type: oauth2
+ config:
+ clientId: "{{.BETTER_AUTH_NEXTJS_CLIENT_ID}}"
+ clientSecret: "{{.BETTER_AUTH_NEXTJS_CLIENT_SECRET}}"
+ redirectUris:
+ {{- range .BETTER_AUTH_NEXTJS_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ postLogoutRedirectUris:
+ {{- range .BETTER_AUTH_NEXTJS_POST_LOGOUT_REDIRECT_URIS}}
+ - {{.}}
+ {{- end}}
+ grantTypes:
+ - authorization_code
+ - refresh_token
+ responseTypes:
+ - code
+ # Better Auth sends the client secret in the request body by default.
+ tokenEndpointAuthMethod: client_secret_post
+ pkceRequired: true
+ publicClient: false
+ token:
+ accessToken:
+ userConfig:
+ validityPeriod: 3600
+ attributes: [given_name, family_name, email]
+ idToken:
+ validityPeriod: 3600
+ userAttributes: [given_name, family_name, email]
+ responseType: JWT
+ userInfo:
+ responseType: JSON
+ userAttributes: [given_name, family_name, email]
+
+---
+resource_type: server_config
+name: cors
+value:
+ allowedOrigins:
+ {{- range .ALL_ORIGINS}}
+ - {{.}}
+ {{- end}}
diff --git a/tests/e2e/shared/utils/api-request/dispatcher.ts b/tests/e2e/shared/utils/api-request/dispatcher.ts
new file mode 100644
index 0000000..9585b72
--- /dev/null
+++ b/tests/e2e/shared/utils/api-request/dispatcher.ts
@@ -0,0 +1,13 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+let dispatcherPromise: Promise | undefined;
+
+/**
+ * A fetch dispatcher that accepts the server's self-signed local or CI certificate, the same
+ * allowance shared/scripts/thunderid.sh makes with `curl -k`.
+ */
+export function insecureDispatcher(): Promise {
+ dispatcherPromise ??= import('undici').then(({Agent}) => new Agent({connect: {rejectUnauthorized: false}}));
+ return dispatcherPromise;
+}
diff --git a/tests/e2e/shared/utils/api-request/index.ts b/tests/e2e/shared/utils/api-request/index.ts
new file mode 100644
index 0000000..0569f3c
--- /dev/null
+++ b/tests/e2e/shared/utils/api-request/index.ts
@@ -0,0 +1,39 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * Authenticated requests to the ThunderID server: the base URL, an admin bearer token, the
+ * self-signed certificate allowance, and one consistent error carrying the status and body.
+ */
+
+import {getAdminToken} from '../authentication/index.ts';
+import {insecureDispatcher} from './dispatcher.ts';
+
+export function serverUrl(): string {
+ return process.env.SERVER_URL ?? 'https://localhost:8090';
+}
+
+type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
+
+/** Authenticated call against the server. Returns the response as is, non-2xx included. */
+export async function send(method: Method, path: string, data?: unknown): Promise {
+ const token = await getAdminToken();
+ return fetch(`${serverUrl()}${path}`, {
+ body: data === undefined ? undefined : JSON.stringify(data),
+ dispatcher: await insecureDispatcher(),
+ headers: {
+ Authorization: `Bearer ${token}`,
+ ...(data === undefined ? {} : {'Content-Type': 'application/json'}),
+ },
+ method,
+ } as RequestInit);
+}
+
+/** Same as `send`, but a non-2xx becomes an error carrying the status and response body. */
+export async function sendOk(method: Method, path: string, data?: unknown): Promise {
+ const response = await send(method, path, data);
+ if (!response.ok) {
+ throw new Error(`${method} ${path} failed (${response.status}): ${await response.text()}`);
+ }
+ return response;
+}
diff --git a/tests/e2e/shared/utils/authentication/index.ts b/tests/e2e/shared/utils/authentication/index.ts
new file mode 100644
index 0000000..1a5aa27
--- /dev/null
+++ b/tests/e2e/shared/utils/authentication/index.ts
@@ -0,0 +1,124 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * Admin token for the suites' own API calls (config import, test users), not the sign-in under
+ * test, which each page object drives through the real UI.
+ *
+ * Uses ADMIN_TOKEN when set. Otherwise mints one through the CONSOLE application, the same
+ * sequence as `mint_admin_token` in shared/scripts/thunderid.sh: authorize -> flow/execute (SSO
+ * check) -> flow/execute (credentials) -> oauth2/auth/callback -> oauth2/token.
+ */
+
+import {createHash, randomBytes} from 'node:crypto';
+import {insecureDispatcher} from '../api-request/dispatcher.ts';
+
+const CONSOLE_CLIENT_ID = 'CONSOLE';
+
+function base64url(input: Buffer): string {
+ return input.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
+}
+
+let tokenPromise: Promise | undefined;
+
+/** One admin token per process, memoized. */
+export function getAdminToken(): Promise {
+ // One retry: the server can refuse a code exchange that races another one (SQLITE_BUSY).
+ tokenPromise ??= mintAdminToken()
+ .catch(() => mintAdminToken())
+ .catch((error: unknown) => {
+ tokenPromise = undefined;
+ throw error;
+ });
+ return tokenPromise;
+}
+
+async function mintAdminToken(): Promise {
+ if (process.env.ADMIN_TOKEN) {
+ return process.env.ADMIN_TOKEN;
+ }
+
+ const serverUrl = process.env.SERVER_URL ?? 'https://localhost:8090';
+ const adminUsername = process.env.ADMIN_USERNAME ?? 'admin';
+ const adminPassword = process.env.ADMIN_PASSWORD ?? 'admin';
+ const redirectUri = `${serverUrl}/console`;
+
+ const codeVerifier = base64url(randomBytes(32)).slice(0, 43);
+ const codeChallenge = base64url(createHash('sha256').update(codeVerifier).digest());
+ const dispatcher = await insecureDispatcher();
+
+ const authorizeUrl = new URL(`${serverUrl}/oauth2/authorize`);
+ authorizeUrl.searchParams.set('client_id', CONSOLE_CLIENT_ID);
+ authorizeUrl.searchParams.set('redirect_uri', redirectUri);
+ authorizeUrl.searchParams.set('scope', 'system');
+ authorizeUrl.searchParams.set('resource', `${serverUrl}/mcp`);
+ authorizeUrl.searchParams.set('response_type', 'code');
+ authorizeUrl.searchParams.set('code_challenge', codeChallenge);
+ authorizeUrl.searchParams.set('code_challenge_method', 'S256');
+
+ const authorizeRes = await fetch(authorizeUrl, {dispatcher, redirect: 'manual'} as RequestInit);
+ const location = authorizeRes.headers.get('location');
+ if (!location) {
+ throw new Error(`No Location header from ${authorizeUrl.pathname}: HTTP ${authorizeRes.status}`);
+ }
+ const locationUrl = new URL(location, serverUrl);
+ const authId = locationUrl.searchParams.get('authId');
+ const executionId = locationUrl.searchParams.get('executionId');
+ if (!authId || !executionId) {
+ throw new Error(`Failed to parse authId/executionId from authorize redirect: ${location}`);
+ }
+
+ const post = async (path: string, body: unknown): Promise> => {
+ const res = await fetch(`${serverUrl}${path}`, {
+ body: JSON.stringify(body),
+ dispatcher,
+ headers: {'Content-Type': 'application/json'},
+ method: 'POST',
+ } as RequestInit);
+ return (await res.json()) as Record;
+ };
+
+ // The first execute advances past the SSO check to the credentials prompt and mints a
+ // challenge token.
+ const prompt = await post('/flow/execute', {executionId});
+ if (!prompt.challengeToken) {
+ throw new Error(`Flow execution did not return a challenge token: ${JSON.stringify(prompt)}`);
+ }
+
+ const creds = await post('/flow/execute', {
+ action: 'action_001',
+ challengeToken: prompt.challengeToken,
+ executionId,
+ inputs: {password: adminPassword, username: adminUsername},
+ });
+ if (!creds.assertion) {
+ throw new Error(`Admin authentication failed: ${JSON.stringify(creds)}`);
+ }
+
+ const callback = await post('/oauth2/auth/callback', {assertion: creds.assertion, authId});
+ const authCode =
+ typeof callback.redirect_uri === 'string' ? new URL(callback.redirect_uri).searchParams.get('code') : null;
+ if (!authCode) {
+ throw new Error(`OAuth2 callback did not return an authorization code: ${JSON.stringify(callback)}`);
+ }
+
+ const tokenRes = await fetch(`${serverUrl}/oauth2/token`, {
+ body: new URLSearchParams({
+ client_id: CONSOLE_CLIENT_ID,
+ code: authCode,
+ code_verifier: codeVerifier,
+ grant_type: 'authorization_code',
+ redirect_uri: redirectUri,
+ resource: `${serverUrl}/mcp`,
+ }),
+ dispatcher,
+ headers: {'Content-Type': 'application/x-www-form-urlencoded'},
+ method: 'POST',
+ } as RequestInit);
+ const tokenData = (await tokenRes.json()) as {access_token?: string};
+ if (!tokenData.access_token) {
+ throw new Error(`Failed to obtain admin access token: ${JSON.stringify(tokenData)}`);
+ }
+
+ return tokenData.access_token;
+}
diff --git a/tests/e2e/shared/utils/import-config/index.ts b/tests/e2e/shared/utils/import-config/index.ts
new file mode 100644
index 0000000..d1f42d9
--- /dev/null
+++ b/tests/e2e/shared/utils/import-config/index.ts
@@ -0,0 +1,60 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * Imports a declarative config with `POST /import`, upserting, so re-running against a server
+ * that already holds the resources is safe. The same call as `thunderid.sh import`.
+ */
+
+import fs from 'node:fs';
+import {sendOk} from '../api-request/index.ts';
+
+export type ImportVariables = Record;
+
+/**
+ * Reads a KEY=VALUE env file. A value that parses as a JSON array stays a list, so a variable such
+ * as REDIRECT_URIS=["http://localhost:3000"] reaches the template as one.
+ */
+export function readEnvFile(file: string): ImportVariables {
+ const variables: ImportVariables = {};
+ for (const line of fs.readFileSync(file, 'utf8').split('\n')) {
+ const match = /^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/.exec(line.trim());
+ if (!match) continue;
+ const [, key, value] = match;
+ let parsed: string | string[] = value;
+ if (value.startsWith('[')) {
+ try {
+ const json: unknown = JSON.parse(value);
+ if (Array.isArray(json)) parsed = json.map(String);
+ } catch {
+ // Not JSON: keep the raw string.
+ }
+ }
+ variables[key] = parsed;
+ }
+ return variables;
+}
+
+/**
+ * Drops the `server_config` documents of the given names from a multi-document config, for a run
+ * against a shared server whose server-wide settings must stay as they are.
+ */
+export function withoutServerConfigs(content: string, names: string[]): string {
+ if (names.length === 0) return content;
+ return content
+ .split(/^---[ \t]*$/m)
+ .filter((doc) => {
+ if (!/^resource_type:\s*server_config\s*$/m.test(doc)) return true;
+ const name = /^name:\s*(\S+)\s*$/m.exec(doc)?.[1];
+ return !name || !names.includes(name);
+ })
+ .join('---');
+}
+
+export async function importConfig(content: string, variables: ImportVariables = {}): Promise {
+ const response = await sendOk('POST', '/import', {content, options: {upsert: true}, variables});
+ const result = (await response.json()) as {summary?: {failed?: number}};
+ if ((result.summary?.failed ?? 0) !== 0) {
+ throw new Error(`POST /import had failed resources: ${JSON.stringify(result)}`);
+ }
+}
diff --git a/tests/e2e/shared/utils/jwt/index.ts b/tests/e2e/shared/utils/jwt/index.ts
new file mode 100644
index 0000000..2898f03
--- /dev/null
+++ b/tests/e2e/shared/utils/jwt/index.ts
@@ -0,0 +1,16 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * Decodes a JWT payload for assertion purposes only, with no signature verification. The token
+ * debug pages under test do the same client-side decode.
+ */
+export function decodeJwtPayload(token: string): Record {
+ const parts = token.split('.');
+ if (parts.length !== 3) {
+ throw new Error(`Expected a JWT with 3 dot-separated parts, got ${parts.length}`);
+ }
+ const base64 = parts[1].replace(/-/g, '+').replace(/_/g, '/');
+ const padded = base64.padEnd(base64.length + ((4 - (base64.length % 4)) % 4), '=');
+ return JSON.parse(Buffer.from(padded, 'base64').toString('utf-8')) as Record;
+}
diff --git a/tests/e2e/shared/utils/organization-units/index.ts b/tests/e2e/shared/utils/organization-units/index.ts
new file mode 100644
index 0000000..b6a516d
--- /dev/null
+++ b/tests/e2e/shared/utils/organization-units/index.ts
@@ -0,0 +1,35 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * Organization units and user sharing, for the B2B suites' multi-company account: the Console's
+ * "Affiliations" tab, done through the API.
+ */
+
+import {sendOk} from '../api-request/index.ts';
+import type {ApiUser} from '../users-api/index.ts';
+
+/** The Default organization unit every B2B sample's companies live beneath. */
+export const DEFAULT_OU_ID = '01900000-0000-7000-8000-000000000001';
+
+export interface ApiOrganizationUnit {
+ handle: string;
+ id: string;
+ name: string;
+}
+
+export async function createChildOrganizationUnit(handle: string, name: string): Promise {
+ const response = await sendOk('POST', '/organization-units', {handle, name, parent: DEFAULT_OU_ID});
+ return (await response.json()) as ApiOrganizationUnit;
+}
+
+/** Creates a user of the given user type in the Default organization unit. */
+export async function createDefaultOuUser(type: string, attributes: Record): Promise {
+ const response = await sendOk('POST', '/users', {attributes, ouId: DEFAULT_OU_ID, type});
+ return (await response.json()) as ApiUser;
+}
+
+/** Shares a user into every organization unit beneath its own, present and future. */
+export async function shareUserWithAllChildUnits(userId: string): Promise {
+ await sendOk('POST', `/users/${userId}/sharing-policies`, {childUnits: {mode: 'all'}});
+}
diff --git a/tests/e2e/shared/utils/user-types-api/index.ts b/tests/e2e/shared/utils/user-types-api/index.ts
new file mode 100644
index 0000000..5eeaaeb
--- /dev/null
+++ b/tests/e2e/shared/utils/user-types-api/index.ts
@@ -0,0 +1,36 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * Thin wrapper over the server's `/user-types` endpoint.
+ */
+
+import {sendOk} from '../api-request/index.ts';
+
+export interface ApiUserType {
+ id: string;
+ name: string;
+ ouId: string;
+}
+
+/** Every user type in the system. The list endpoint has no name filter, so this pages until done. */
+export async function listUserTypes(): Promise {
+ const pageSize = 100;
+ const all: ApiUserType[] = [];
+
+ for (let offset = 0; ; ) {
+ const response = await sendOk('GET', `/user-types?limit=${pageSize}&offset=${offset}`);
+ const body = (await response.json()) as {totalResults?: number; types?: ApiUserType[]};
+ const page = body.types ?? [];
+ all.push(...page);
+ offset += page.length;
+ if (page.length < pageSize || offset >= (body.totalResults ?? offset)) {
+ return all;
+ }
+ }
+}
+
+export async function findUserTypeByName(name: string): Promise {
+ const types = await listUserTypes();
+ return types.find((type) => type.name === name);
+}
diff --git a/tests/e2e/shared/utils/users-api/index.ts b/tests/e2e/shared/utils/users-api/index.ts
new file mode 100644
index 0000000..7e8db66
--- /dev/null
+++ b/tests/e2e/shared/utils/users-api/index.ts
@@ -0,0 +1,68 @@
+// Copyright 2026 The ThunderID Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * Thin wrapper over the server's `/users` endpoint, for creating and resetting test users.
+ */
+
+import {send, sendOk} from '../api-request/index.ts';
+import {findUserTypeByName} from '../user-types-api/index.ts';
+
+export interface ApiUser {
+ attributes?: Record;
+ id: string;
+ ouId?: string;
+ type?: string;
+}
+
+export async function findUserByUsername(username: string): Promise {
+ const filter = `username eq "${username}"`;
+ const response = await sendOk('GET', `/users?filter=${encodeURIComponent(filter)}`);
+ const {users} = (await response.json()) as {users?: ApiUser[]};
+ return (users ?? []).find((candidate) => candidate.attributes?.username === username);
+}
+
+/** Create a user directly through the API, bypassing any UI. */
+export async function createUser(attributes: Record, type = 'Person'): Promise {
+ const userType = await findUserTypeByName(type);
+ if (!userType) {
+ throw new Error(`GET /user-types returned no "${type}" user type`);
+ }
+ const response = await sendOk('POST', '/users', {attributes, ouId: userType.ouId, type: userType.name});
+ return (await response.json()) as ApiUser;
+}
+
+/** Delete a user by id. Returns false, rather than throwing, if the delete failed. */
+export async function deleteUser(userId: string): Promise {
+ const response = await send('DELETE', `/users/${userId}`);
+ return response.ok;
+}
+
+/** Set a user's password through the admin API, bypassing any UI. */
+export async function setUserPassword(username: string, password: string): Promise {
+ const user = await findUserByUsername(username);
+ if (!user) {
+ throw new Error(`No user "${username}" to set the password for`);
+ }
+ await sendOk('POST', `/users/${user.id}/update-credentials`, {credentials: {password}});
+}
+
+/**
+ * Makes sure a Person user with this username exists and signs in with this password. Creates it
+ * when missing; otherwise resets the password, which an interrupted change-credential test can
+ * leave changed. Safe to run against a server a previous run already provisioned.
+ */
+export async function ensureUser(username: string, password: string, givenName = 'Test'): Promise {
+ const existing = await findUserByUsername(username);
+ if (existing) {
+ await sendOk('POST', `/users/${existing.id}/update-credentials`, {credentials: {password}});
+ return existing;
+ }
+ return createUser({
+ email: `${username}@example.com`,
+ family_name: 'E2E',
+ given_name: givenName,
+ password,
+ username,
+ });
+}
diff --git a/tests/e2e/tsconfig.json b/tests/e2e/tsconfig.json
new file mode 100644
index 0000000..6a8596f
--- /dev/null
+++ b/tests/e2e/tsconfig.json
@@ -0,0 +1,18 @@
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "module": "ESNext",
+ "moduleResolution": "Bundler",
+ "lib": ["ES2022", "DOM"],
+ "strict": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "resolveJsonModule": true,
+ "allowImportingTsExtensions": true,
+ "types": ["node"],
+ "noEmit": true
+ },
+ "include": ["**/*.ts"],
+ "exclude": ["node_modules", "**/node_modules", "playwright-report", "test-results", ".thunderid-server"]
+}