Skip to content

Improve the B2B quickstarts - #29

Merged
AnuradhaSK merged 1 commit into
thunder-id:mainfrom
AnuradhaSK:improve-samples
Nov 15, 2026
Merged

AnuradhaSK merged 1 commit into
thunder-id:mainfrom
AnuradhaSK:improve-samples

Conversation

@AnuradhaSK

@AnuradhaSK AnuradhaSK commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Improves the B2B quickstarts (quickstarts/react-b2b, quickstarts/nextjs-b2b), and removes the client secret values from them and from Wayfinder Enterprise (b2b/wayfinder-enterprise).

Approach

Default organization unit as the business unit

  • Both quickstarts import one file, thunderid-config/thunderid-config.yaml, into the Default organization unit. organization-unit.yaml and the root organization unit it created are gone.
  • Every resource uses ouHandle: default, and the flows' parentOuId points at the Default organization unit, so each company that signs up becomes its child.
  • The roles are Next.js B2B Admin / Next.js B2B Member and React B2B Admin / React B2B Member. With both quickstarts in one unit, same-named roles fail with ROL-1004.

Switching without a redirect

  • Next.js: @thunderid/nextjs 1.20.0. device_sso is added to NEXT_PUBLIC_THUNDERID_SCOPES, and the application allows urn:ietf:params:oauth:grant-type:token-exchange, so the server switches companies with the device secret.
  • React: @thunderid/react 1.22.1, which redeems a switch callback while signed in, so the sample's workaround in App.jsx is removed. device_sso is in the provider's scopes. The app runs on http://localhost:5173, without @vitejs/plugin-basic-ssl.

No secret values in the samples

  • NEXTJS_B2B_CLIENT_SECRET, WAYFINDER_ENTERPRISE_CLIENT_SECRET and WAYFINDER_ENTERPRISE_BACKEND_CLIENT_SECRET ship empty in thunderid.env. Comments say how to generate a value and which app variable takes the same one.
  • THUNDERID_CLIENT_SECRET, WAYFINDER_BACKEND_CLIENT_SECRET and THUNDERID_SECRET ship empty in .env.example.
  • The Console flags an empty value as missing and blocks the import. The value can be entered in its Environment variables editor.

READMEs

  • One import step. The resource tables list the Default organization unit's resources and the new role names.
  • "One account across several companies": until the sample can invite an existing account into another company, readers create the account in the Control Plane console. They give it the sample's user type, which places it in the Default organization unit, and grant it all child organization units on Affiliations.
  • "Switching companies" (Next.js) explains the in-place switch and the redirect fallback.
  • The intros are one sentence. The repository README's sample descriptions are shorter.

Related Issues

Related PRs

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
    • On a fresh ThunderID 2.0.0-m1 (local build from main), imported both quickstarts into the Default organization unit (all resources imported, including all four roles) and ran both apps.
    • Next.js: registered northstar (account inside the company) and initech (shared account). Both landed as Next.js B2B Admin with org.
    • React: registered globex, which landed as React B2B Admin.
    • Created a platform-level account in the Control Plane console with all child organization units. It signed in to northstar and switched to initech on the same page, with one POST /ou/{ouId}/oauth2/token and no redirect.
    • Imported the Next.js config with a generated client secret and signed in with the same value in .env. With the shipped empty value, the import is blocked until the secret is entered.
  • Documentation provided. (Add links if there are any)
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards.
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

🤖 Generated with Claude Code

@AnuradhaSK
AnuradhaSK force-pushed the improve-samples branch 2 times, most recently from bee8bce to 931b48a Compare November 14, 2026 13:06
@AnuradhaSK
AnuradhaSK marked this pull request as ready for review November 14, 2026 13:09
Signed-off-by: AnuradhaSK <anuradha199528@gmail.com>
@AnuradhaSK
AnuradhaSK merged commit 1bb6fb8 into thunder-id:main Nov 15, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants