Skip to main content
The WorkOS Node.js SDK provides convenient access to the WorkOS API from applications written in server-side JavaScript. Build enterprise-ready authentication and user management with minimal code.

Key features

The WorkOS Node.js SDK enables you to integrate enterprise features quickly:

Single Sign-On (SSO)

Connect to any identity provider with SAML or OAuth 2.0

User Management

Complete authentication system with AuthKit

Directory Sync

Sync user directories from identity providers

Admin Portal

Self-serve configuration for enterprise customers

Audit Logs

Enterprise-grade audit trail for compliance

Multi-Factor Auth

Add MFA to your authentication flows

Fine-Grained Authorization

Implement advanced permission systems

Organizations

Manage multi-tenant organizations

Requirements

Node.js 20.15.0 or higher is required to use this SDK.
The SDK supports multiple JavaScript runtimes:
  • Node.js - 20.15.0+
  • Bun - Full support
  • Deno - Full support
  • Edge runtimes - Cloudflare Workers, Vercel Edge, etc.

Public client mode

For applications that cannot securely store secrets (browser apps, mobile apps, CLI tools), the SDK supports PKCE-based authentication:
import { WorkOS } from '@workos-inc/node';

// Initialize with only a client ID (no API key needed)
const workos = new WorkOS({ clientId: 'client_...' });

// Generate auth URL with automatic PKCE
const { url, codeVerifier } = await workos.userManagement.getAuthorizationUrlWithPKCE({
  provider: 'authkit',
  redirectUri: 'myapp://callback',
  clientId: 'client_...',
});

// After user authenticates, exchange code for tokens
const { accessToken, refreshToken } = await workos.userManagement.authenticateWithCode({
  code: authorizationCode,
  codeVerifier,
  clientId: 'client_...',
});
Store the codeVerifier securely on-device between generating the auth URL and handling the callback. For mobile apps, use platform secure storage (iOS Keychain, Android Keystore).

Getting started

Installation

Install the SDK using your preferred package manager

Quickstart

Get up and running with a simple example

Configuration

Configure the WorkOS client for your application

SDK versioning

WorkOS follows Semantic Versioning (SemVer) for all SDK releases:
  • Major versions (X.0.0) - Breaking changes
  • Minor versions (0.X.0) - New features, backward compatible
  • Patch versions (0.0.X) - Bug fixes
Always read the changelog before making major version upgrades to understand breaking changes.

Support

Need help? Here are some resources:

Build docs developers (and LLMs) love