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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/browser/quickstart/.stackblitzrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"installDependencies": false,
"startCommand": "node -e \"const fs=require(\\\"fs\\\");const p=JSON.parse(fs.readFileSync(\\\"package.json\\\"));[\\\"dependencies\\\",\\\"devDependencies\\\"].forEach(f=>{if(p[f])Object.keys(p[f]).forEach(k=>{if(p[f][k].startsWith(\\\"workspace:\\\"))p[f][k]=\\\"latest\\\"})});fs.writeFileSync(\\\"package.json\\\",JSON.stringify(p,null,2)+\\\"\\\\n\\\")\" && npm install && npm run dev"
"startCommand": "npm run prepare-dev && npm install && npm run dev"
}
19 changes: 2 additions & 17 deletions samples/browser/quickstart/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
# ThunderID Browser Quickstart

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/thunder-id/javascript-sdks/tree/main/samples/browser/quickstart)
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/thunder-id/javascript-sdks/tree/main/samples/browser/quickstart?file=.env&terminal=dev)

A minimal Vite + vanilla JS app demonstrating sign-in and sign-out with the ThunderID JavaScript SDK (`@thunderid/browser`).

## Prerequisites

- Node.js 18+
- A running ThunderID instance (default: `https://localhost:8090`)
- A configured application with an authorized redirect URI set to your app's origin (see [Import ThunderID Resources](#import-thunderid-resources) below)

## Import ThunderID Resources

This sample ships with a `thunderid-config/` directory containing a declarative YAML file that creates the required user type and application in one step.

1. Open `thunderid-config/thunderid.env` and set your preferred values:
```bash
BROWSER_QUICKSTART_CLIENT_ID=BROWSER_QUICKSTART
BROWSER_QUICKSTART_REDIRECT_URIS=["http://localhost:5173"]
```
2. Import via the ThunderID Console (https://localhost:8090/console):
- **First-time login**: a welcome screen appears with an **Open** button to upload the YAML file directly.
- **Later**: access the same welcome screen from the user profile menu in the top-right corner of the console.

This creates the `Customer` user type and the `browser-quickstart` application under the default organization unit.
- A configured application with an authorized redirect URI set to your app's origin

## Getting started

Expand Down
1 change: 1 addition & 0 deletions samples/browser/quickstart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"prepare-dev": "node scripts/prepare-dev.cjs",
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
Expand Down
28 changes: 28 additions & 0 deletions samples/browser/quickstart/scripts/prepare-dev.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2026 The ThunderID Authors
// SPDX-License-Identifier: Apache-2.0

const fs = require('node:fs');
const path = require('node:path');

const root = path.join(__dirname, '..');

const envExample = path.join(root, '.env.example');
const envTarget = path.join(root, '.env');
if (fs.existsSync(envExample) && !fs.existsSync(envTarget)) {
fs.copyFileSync(envExample, envTarget);
}

const pkgPath = path.join(root, 'package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

for (const field of ['dependencies', 'devDependencies']) {
const deps = pkg[field];
if (!deps) continue;
for (const [name, version] of Object.entries(deps)) {
if (version.startsWith('workspace:')) {
deps[name] = 'latest';
}
}
}

fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
2 changes: 1 addition & 1 deletion samples/express/quickstart/.stackblitzrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"installDependencies": false,
"startCommand": "node -e \"const fs=require(\\\"fs\\\");const p=JSON.parse(fs.readFileSync(\\\"package.json\\\"));[\\\"dependencies\\\",\\\"devDependencies\\\"].forEach(f=>{if(p[f])Object.keys(p[f]).forEach(k=>{if(p[f][k].startsWith(\\\"workspace:\\\"))p[f][k]=\\\"latest\\\"})});fs.writeFileSync(\\\"package.json\\\",JSON.stringify(p,null,2)+\\\"\\\\n\\\")\" && npm install && npm run dev"
"startCommand": "npm run prepare-dev && npm install && npm run dev"
}
20 changes: 2 additions & 18 deletions samples/express/quickstart/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ThunderID Express Quickstart

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/thunder-id/javascript-sdks/tree/main/samples/express/quickstart)
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/thunder-id/javascript-sdks/tree/main/samples/express/quickstart?file=.env&terminal=dev)

A minimal Express.js **API** protected by ThunderID access tokens, using the ThunderID JavaScript
SDK (`@thunderid/express`). Unlike the browser-focused quickstarts, this sample doesn't have a
Expand All @@ -16,23 +16,7 @@ Protected routes validate the `Authorization: Bearer <token>` header against Thu

- Node.js 18+
- A running ThunderID instance (default: `https://localhost:8090`)
- A configured application with `http://localhost:3000/login` added as an authorized redirect URI (see [Import ThunderID Resources](#import-thunderid-resources) below)

## Import ThunderID Resources

This sample ships with a `thunderid-config/` directory containing a declarative YAML file that creates the required user type and application in one step.

1. Open `thunderid-config/thunderid.env` and set your preferred values:
```bash
EXPRESS_QUICKSTART_CLIENT_ID=EXPRESS_QUICKSTART
EXPRESS_QUICKSTART_CLIENT_SECRET=<a strong secret>
EXPRESS_QUICKSTART_REDIRECT_URIS=["http://localhost:3000/login"]
```
2. Import via the ThunderID Console (https://localhost:8090/console):
- **First-time login**: a welcome screen appears with an **Open** button to upload the YAML file directly.
- **Later**: access the same welcome screen from the user profile menu in the top-right corner of the console.

This creates the `Customer` user type and the `express-quickstart` application under the default organization unit.
- A configured application with `http://localhost:3000/login` added as an authorized redirect URI

## Getting started

Expand Down
1 change: 1 addition & 0 deletions samples/express/quickstart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"prepare-dev": "node scripts/prepare-dev.cjs",
"start": "node --env-file-if-exists=.env index.mjs",
"dev": "node --env-file-if-exists=.env --watch index.mjs"
},
Expand Down
28 changes: 28 additions & 0 deletions samples/express/quickstart/scripts/prepare-dev.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2026 The ThunderID Authors
// SPDX-License-Identifier: Apache-2.0

const fs = require('node:fs');
const path = require('node:path');

const root = path.join(__dirname, '..');

const envExample = path.join(root, '.env.example');
const envTarget = path.join(root, '.env');
if (fs.existsSync(envExample) && !fs.existsSync(envTarget)) {
fs.copyFileSync(envExample, envTarget);
}

const pkgPath = path.join(root, 'package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

for (const field of ['dependencies', 'devDependencies']) {
const deps = pkg[field];
if (!deps) continue;
for (const [name, version] of Object.entries(deps)) {
if (version.startsWith('workspace:')) {
deps[name] = 'latest';
}
}
}

fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
2 changes: 1 addition & 1 deletion samples/nextjs/quickstart/.stackblitzrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"installDependencies": false,
"startCommand": "node -e \"const fs=require(\\\"fs\\\");const p=JSON.parse(fs.readFileSync(\\\"package.json\\\"));[\\\"dependencies\\\",\\\"devDependencies\\\"].forEach(f=>{if(p[f])Object.keys(p[f]).forEach(k=>{if(p[f][k].startsWith(\\\"workspace:\\\"))p[f][k]=\\\"latest\\\"})});fs.writeFileSync(\\\"package.json\\\",JSON.stringify(p,null,2)+\\\"\\\\n\\\")\" && npm install && npm run dev"
"startCommand": "npm run prepare-dev && npm install && npm run dev"
}
23 changes: 2 additions & 21 deletions samples/nextjs/quickstart/README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,14 @@
# ThunderID Next.js Quickstart

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/thunder-id/javascript-sdks/tree/main/samples/nextjs/quickstart)
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/thunder-id/javascript-sdks/tree/main/samples/nextjs/quickstart?file=.env.local&terminal=dev)

A minimal Next.js 15 App Router application demonstrating ThunderID authentication with OAuth 2.0, PKCE, and JWT out of the box.

## Prerequisites

- Node.js 18+
- pnpm
- A ThunderID application (see [Import ThunderID Resources](#import-thunderid-resources) below)

## Import ThunderID Resources

This sample ships with a `thunderid-config/` directory containing a declarative YAML file that creates the required user type and application in one step.

1. Open `thunderid-config/thunderid.env` and set your preferred values:

```bash
NEXTJS_QUICKSTART_APPLICATION_ID=<uuid, e.g. generate with: uuidgen>
NEXTJS_QUICKSTART_CLIENT_ID=NEXTJS_QUICKSTART
NEXTJS_QUICKSTART_CLIENT_SECRET=<a strong secret>
NEXTJS_QUICKSTART_REDIRECT_URIS=["http://localhost:3000"]
```

2. Import via the ThunderID Console ([https://localhost:8090/console](https://localhost:8090/console)):
- **First-time login**: a welcome screen appears with an **Open** button to upload the YAML file directly.
- **Later**: access the same welcome screen from the user profile menu in the top-right corner of the console.

This creates the `Customer` user type and the `nextjs-quickstart` application under the default organization unit. Note the `NEXTJS_QUICKSTART_APPLICATION_ID` value — unlike the client ID, this is a fixed id (not server-assigned) because it also drives the embedded sign-in/sign-up UI, so you'll copy it verbatim into `.env.local` below.
- A ThunderID application

## Getting started

Expand Down
1 change: 1 addition & 0 deletions samples/nextjs/quickstart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"private": true,
"version": "0.0.0",
"scripts": {
"prepare-dev": "node scripts/prepare-dev.cjs",
"dev": "next dev",
"build": "next build",
"start": "next start"
Expand Down
28 changes: 28 additions & 0 deletions samples/nextjs/quickstart/scripts/prepare-dev.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2026 The ThunderID Authors
// SPDX-License-Identifier: Apache-2.0

const fs = require('node:fs');
const path = require('node:path');

const root = path.join(__dirname, '..');

const envExample = path.join(root, '.env.example');
const envTarget = path.join(root, '.env.local');
if (fs.existsSync(envExample) && !fs.existsSync(envTarget)) {
fs.copyFileSync(envExample, envTarget);
}

const pkgPath = path.join(root, 'package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

for (const field of ['dependencies', 'devDependencies']) {
const deps = pkg[field];
if (!deps) continue;
for (const [name, version] of Object.entries(deps)) {
if (version.startsWith('workspace:')) {
deps[name] = 'latest';
}
}
}

fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
2 changes: 1 addition & 1 deletion samples/node/quickstart/.stackblitzrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"installDependencies": false,
"startCommand": "node -e \"const fs=require(\\\"fs\\\");const p=JSON.parse(fs.readFileSync(\\\"package.json\\\"));[\\\"dependencies\\\",\\\"devDependencies\\\"].forEach(f=>{if(p[f])Object.keys(p[f]).forEach(k=>{if(p[f][k].startsWith(\\\"workspace:\\\"))p[f][k]=\\\"latest\\\"})});fs.writeFileSync(\\\"package.json\\\",JSON.stringify(p,null,2)+\\\"\\\\n\\\")\" && npm install && npm run dev"
"startCommand": "npm run prepare-dev && npm install && npm run dev"
}
2 changes: 1 addition & 1 deletion samples/node/quickstart/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ThunderID Node.js Service Quickstart

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/thunder-id/javascript-sdks/tree/main/samples/node/quickstart)
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/thunder-id/javascript-sdks/tree/main/samples/node/quickstart?file=.env&terminal=dev)

A minimal machine-to-machine (service-to-service) client, using the ThunderID Node.js SDK
(`@thunderid/node`). Unlike the other quickstarts, there's no user and no browser sign-in: this
Expand Down
1 change: 1 addition & 0 deletions samples/node/quickstart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"prepare-dev": "node scripts/prepare-dev.cjs",
"start": "node --env-file-if-exists=.env index.mjs",
"dev": "node --env-file-if-exists=.env --watch index.mjs"
},
Expand Down
28 changes: 28 additions & 0 deletions samples/node/quickstart/scripts/prepare-dev.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2026 The ThunderID Authors
// SPDX-License-Identifier: Apache-2.0

const fs = require('node:fs');
const path = require('node:path');

const root = path.join(__dirname, '..');

const envExample = path.join(root, '.env.example');
const envTarget = path.join(root, '.env');
if (fs.existsSync(envExample) && !fs.existsSync(envTarget)) {
fs.copyFileSync(envExample, envTarget);
}

const pkgPath = path.join(root, 'package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

for (const field of ['dependencies', 'devDependencies']) {
const deps = pkg[field];
if (!deps) continue;
for (const [name, version] of Object.entries(deps)) {
if (version.startsWith('workspace:')) {
deps[name] = 'latest';
}
}
}

fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
2 changes: 1 addition & 1 deletion samples/nuxt/quickstart/.stackblitzrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"installDependencies": false,
"startCommand": "node -e \"const fs=require(\\\"fs\\\");const p=JSON.parse(fs.readFileSync(\\\"package.json\\\"));[\\\"dependencies\\\",\\\"devDependencies\\\"].forEach(f=>{if(p[f])Object.keys(p[f]).forEach(k=>{if(p[f][k].startsWith(\\\"workspace:\\\"))p[f][k]=\\\"latest\\\"})});fs.writeFileSync(\\\"package.json\\\",JSON.stringify(p,null,2)+\\\"\\\\n\\\")\" && npm install && npm run dev"
"startCommand": "npm run prepare-dev && npm install && npm run dev"
}
23 changes: 2 additions & 21 deletions samples/nuxt/quickstart/README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,14 @@
# ThunderID Nuxt Quickstart

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/thunder-id/javascript-sdks/tree/main/samples/nuxt/quickstart)
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/thunder-id/javascript-sdks/tree/main/samples/nuxt/quickstart?file=.env&terminal=dev)

A minimal Nuxt 3 application demonstrating ThunderID authentication with OAuth 2.0, PKCE, and JWT out of the box.

## Prerequisites

- Node.js 18+
- pnpm
- A ThunderID application (see [Import ThunderID Resources](#import-thunderid-resources) below)

## Import ThunderID Resources

This sample ships with a `thunderid-config/` directory containing a declarative YAML file that creates the required user type and application in one step.

1. Open `thunderid-config/thunderid.env` and set your preferred values:

```bash
NUXT_QUICKSTART_APPLICATION_ID=<uuid, e.g. generate with: uuidgen>
NUXT_QUICKSTART_CLIENT_ID=NUXT_QUICKSTART
NUXT_QUICKSTART_CLIENT_SECRET=<a strong secret>
NUXT_QUICKSTART_REDIRECT_URIS=["http://localhost:3000/api/auth/callback"]
```

2. Import via the ThunderID Console ([https://localhost:8090/console](https://localhost:8090/console)):
- **First-time login**: a welcome screen appears with an **Open** button to upload the YAML file directly.
- **Later**: access the same welcome screen from the user profile menu in the top-right corner of the console.

This creates the `Customer` user type and the `nuxt-quickstart` application under the default organization unit. Note the `NUXT_QUICKSTART_APPLICATION_ID` value — unlike the client ID, this is a fixed id (not server-assigned) because it also drives the embedded sign-in UI, so you'll copy it verbatim into `.env` below.
- A ThunderID application

## Getting started

Expand Down
1 change: 1 addition & 0 deletions samples/nuxt/quickstart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"private": true,
"version": "0.0.0",
"scripts": {
"prepare-dev": "node scripts/prepare-dev.cjs",
"dev": "TMPDIR=/tmp/nuxt-tmp/ nuxt dev",
"build": "nuxt build",
"generate": "nuxt generate",
Expand Down
28 changes: 28 additions & 0 deletions samples/nuxt/quickstart/scripts/prepare-dev.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2026 The ThunderID Authors
// SPDX-License-Identifier: Apache-2.0

const fs = require('node:fs');
const path = require('node:path');

const root = path.join(__dirname, '..');

const envExample = path.join(root, '.env.example');
const envTarget = path.join(root, '.env');
if (fs.existsSync(envExample) && !fs.existsSync(envTarget)) {
fs.copyFileSync(envExample, envTarget);
}

const pkgPath = path.join(root, 'package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

for (const field of ['dependencies', 'devDependencies']) {
const deps = pkg[field];
if (!deps) continue;
for (const [name, version] of Object.entries(deps)) {
if (version.startsWith('workspace:')) {
deps[name] = 'latest';
}
}
}

fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
2 changes: 1 addition & 1 deletion samples/react/quickstart/.stackblitzrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"installDependencies": false,
"startCommand": "node -e \"const fs=require(\\\"fs\\\");const p=JSON.parse(fs.readFileSync(\\\"package.json\\\"));[\\\"dependencies\\\",\\\"devDependencies\\\"].forEach(f=>{if(p[f])Object.keys(p[f]).forEach(k=>{if(p[f][k].startsWith(\\\"workspace:\\\"))p[f][k]=\\\"latest\\\"})});fs.writeFileSync(\\\"package.json\\\",JSON.stringify(p,null,2)+\\\"\\\\n\\\")\" && npm install && npm run dev"
"startCommand": "npm run prepare-dev && npm install && npm run dev"
}
19 changes: 2 additions & 17 deletions samples/react/quickstart/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
# ThunderID React Quickstart

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/thunder-id/javascript-sdks/tree/main/samples/react/quickstart)
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/thunder-id/javascript-sdks/tree/main/samples/react/quickstart?file=.env&terminal=dev)

A minimal React + Vite application demonstrating ThunderID authentication with OAuth 2.0, PKCE, and JWT support using the `@thunderid/react` SDK.

## Prerequisites

- Node.js 18+
- pnpm
- A ThunderID application (see [Import ThunderID Resources](#import-thunderid-resources) below)

## Import ThunderID Resources

This sample ships with a `thunderid-config/` directory containing a declarative YAML file that creates the required user type and application in one step.

1. Open `thunderid-config/thunderid.env` and set your preferred values:
```bash
REACT_QUICKSTART_CLIENT_ID=REACT_QUICKSTART
REACT_QUICKSTART_REDIRECT_URIS=["http://localhost:5173"]
```
2. Import via the ThunderID Console (https://localhost:8090/console):
- **First-time login**: a welcome screen appears with an **Open** button to upload the YAML file directly.
- **Later**: access the same welcome screen from the user profile menu in the top-right corner of the console.

This creates the `Customer` user type and the `react-quickstart` application under the default organization unit.
- A ThunderID application

## Setup

Expand Down
Loading
Loading