Skip to content

WorkOS

Emulated WorkOS API for local development and testing.

Included now:

  • User Management: authenticate, users, organization memberships, invitations, user API keys
  • Organizations and organization domains
  • API key validation (/api_keys/validations)
  • OAuth 2.0 / OIDC: hosted authorize pages, dynamic client registration, token exchange (RFC 8693 id-jag), JWKS, discovery metadata
  • Vault KV (/vault/v1/kv)
  • Admin portal link generation

JWTs are signed with a real key (via jose) and verify against /oauth2/jwks.

Terminal window
# From this repo (after `bun install && bun run build`)
bun packages/emulate/dist/index.js --service workos
# Or from the published package
npx @pleaseai/emulate --service workos

A single service starts on the base port (default 4000). Use -p <port> to change it. When started alongside other services, ports are assigned sequentially from the base port.

Any sk_-prefixed bearer token is accepted as the API key.

import { WorkOS } from '@workos-inc/node'
const workos = new WorkOS('sk_test_emulate', { apiHostname: 'localhost', port: 4000, https: false })
Terminal window
curl http://localhost:4000/user_management/organization_memberships \
-H "Authorization: Bearer sk_test_emulate"

Add a workos: section to emulate.config.yaml (or pass --seed <file>):

workos:
users:
- email: dev@example.com
first_name: Dev
last_name: Eloper
organizations:
- name: Demo Org
members:
- dev@example.com
oauth:
default_access_token_ttl_seconds: 3600