API reference
Full referenceThunderIDNodeClientThunderIDNodeClient is an abstract base class that extends ThunderIDJavaScriptClient with Node.js-specific configuration. Use this class as the foundation when building a new framework-specific authentication client for a Node.js runtime. Examples include adapters for other Node.js server frameworks.getAccessibleOrganizationUnits(config)Promise<AccessibleOrganizationUnitList>An exported function rather than a method. Lists the organization units the signed-in user can access, from `GET /users/me/ous`. Pass the access token from `getAccessToken(userId)` in `headers`.
getCurrentOrganizationUnit(userId?)Promise<CurrentOrganizationUnit | null>The organization unit the session was issued for, from its `ouId`, `ouHandle`, and `ouName` claims, or `null` when it names none. The claims are not verified, so use the result for display only.
switchOrganizationUnit(organizationUnitId, options)Promise<undefined>Builds the unit's authorization URL, `{baseUrl}/ou/{ouId}/oauth2/authorize`, and hands it to `options.authURLCallback` to redirect the user to. Complete it with `signIn(authURLCallback, userId, code, state)` on the callback, which redeems the code at `/ou/{ouId}/oauth2/token` and replaces the tokens of the session `options.userId`. Until then, and when the callback carries an error, the previous session stays as it was.
import { ThunderIDNodeClient, ThunderIDNodeConfig } from '@thunderid/node'interface MyFrameworkConfig extends ThunderIDNodeConfig {customOption?: string}class MyFrameworkClient extends ThunderIDNodeClient<MyFrameworkConfig> {// Add framework-specific methods or override inherited ones here}export default MyFrameworkClient
Get started
Provider, session, and a protected route, start to finish.
Connect your application
Getting started / Connect your application / Node.js
The quickstart is maintained alongside the rest of the getting-started guides so it stays in step with the platform. This page covers the package itself.
Guides
Task-focused walkthroughs maintained alongside the SDK.
Accessing Protected APIs
Use the access token to call downstream APIs from a Node.js server-side application
5 min readHandling Authentication
Set up sign-in and sign-out flows in a Node.js application using the ThunderID Node.js SDK
5 min readProtecting Routes
Restrict access to routes based on authentication state using the ThunderID Node.js SDK
6 min read