Skip to content
Back to skills

Workos Knowledge Patch

ASecurity

WorkOS

  • 25 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added May 27, 2026
developmentjavascriptpythongojavareactnextjsnodeazureapi

Works with

  • cursor
  • terminal
  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill workos-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Workos Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Workos Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-workos-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-workos-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: workos-knowledge-patch
description: WorkOS
version: "12.4.1"
license: MIT
metadata:
  author: Nevaberry
---


# WorkOS Knowledge Patch

Load this skill when integrating WorkOS, upgrading its SDKs, or working with
AuthKit, SSO, Directory Sync, authorization, and platform products.
Read the relevant topic reference for complete guidance and examples.

## Reference index

| Reference | Topics |
| --- | --- |
| [API and SDK contracts](references/api-and-sdk-contracts.md) | PKCE clients, Python, Go, SDK selection, integrations, OpenAPI |
| [Authentication and sessions](references/authentication-and-sessions.md) | Authorization URLs, cookies, token verification, providers, users, Radar |
| [AuthKit for Next.js](references/authkit-nextjs.md) | Callbacks, PKCE, proxy composition, caching, providers, tokens, API keys |
| [AuthKit for React](references/authkit-react.md) | Browser setup, external sign-in, state, token refresh, organization switching |
| [Authorization and features](references/authorization-and-features.md) | Resources, FGA migration, groups, roles, memberships, API keys, feature flags |
| [Node SDK migrations](references/node-sdk-migrations.md) | Runtime requirements, response types, HTTP, pagination, events, webhooks |
| [Platform products](references/platform-products.md) | Pipes, Connect, MCP, agents, Vault, Audit Logs, delivery, operations |
| [SSO, Directory Sync, and widgets](references/sso-directory-and-widgets.md) | Connections, provisioning, Admin Portal, domains, IT contacts, widgets |

## Breaking changes and deprecations

### Node SDK response contracts

In v12.0.0, API timestamps deserialize as JavaScript `Date` objects. Update
consumers that parse or compare these fields as strings. Nullable SSO `Profile`
fields are required properties holding `null`; handle `null` in consumers and
supply it for missing values in typed fixtures. SDK enums and nullable types
align with the API spec, so check exhaustive branches and nullable fields.

v12.0.0 adds `UnknownEvent` to the `Event` union and 28 event types defined in
the API spec. Include a fallback for unrecognized events and review exhaustive
handlers. Directory Sync moves to SDK code generated from the API spec as a
breaking change; check existing calls and response types against its definitions.

### Removed and renamed options

- When upgrading to v12.2.0, drop `order` from `listEvents()` calls: the endpoint
  does not support it. Earlier event-order guidance is superseded.
- When upgrading to v12.0.0, replace Admin Portal `adminEmails` with
  `itContactEmails`. Update affected Vault imports to the remaining object types
  after removal of duplicate interfaces.
- When upgrading to v10, remove `search` from Authorization `listResources()`.
  When constructing `Webhooks` directly, use `new Webhooks(sdk)` in place of
  the previous crypto provider argument.
- When upgrading to v9, change `sdk.portal` to `sdk.adminPortal`. Migrate legacy
  FGA integrations before this upgrade: v8.4.0 deprecates FGA and v9 removes
  the package. Review Authorization list calls for standardized pagination.
- Starting with v8.3.1, match `api_key.revoked` in handlers that previously
  matched `api_key.deleted`.

### Runtime and connection assumptions

Before installing the v9 Node SDK, upgrade to Node.js 22.11 or later. The
README separately specifies Node.js 20 or later; use the explicit v9 minimum
for a v9 installation.

Node SDK v11.0.0 adds organization-owned connections and multiple connections
as a breaking change in Pipes. Review assumptions that connections are always
user-owned or that only one connection is available.

From v12.2.0, session-cookie authentication requires a user access token.
From v12.3.0, `OrganizationMembership.organizationName` can be `undefined`;
use `membership.organizationName ?? fallbackName` where a string is required.

### Next.js PKCE migration

AuthKit for Next.js v3 enables PKCE on every authorization request. Remove
`WORKOS_ENABLE_PKCE`, preserve `Set-Cookie` through redirects, and return
`wos-auth-verifier` on the callback. A missing cookie fails with
`Auth cookie missing`; a cookie differing from URL `state` fails with
`OAuth state mismatch`. The callback clears the verifier cookie after use.

## HTTP, pagination, and verification

From v10.14.0, pass raw path parameter values to legacy modules so the SDK
URL-encodes them once. Request timeouts also cover response-body reads, so a
slow body can time out after headers arrive. From v12.3.0, SDK API requests
stop at HTTP redirect responses. The HTTP client supports configurable retries,
and DELETE requests forward parameters supplied through `query`.

From v12.0.0, automatic pagination drops the initial `before` cursor on
follow-up requests. From v12.2.0, `autoPagination()` starts with the page
already returned by the list call and fetches subsequent pages as needed.

From v9.3.1, pass raw request bytes to webhook signature verification and
preserve the body before JSON parsing if the framework would discard it.
v12.0.0 rejects malformed and future webhook timestamps. From v12.4.1, JWT
verification rejects algorithms outside the SDK's explicit allowlist.

## Authentication and session quick reference

### Node PKCE clients

For browser, mobile, or CLI public clients, initialize with only a client ID:
`new WorkOS({ clientId })`. Call `getAuthorizationUrlWithPKCE()`, open the
returned `url`, and keep `codeVerifier` in secure on-device storage until the
callback, including across app restarts. Exchange the code using
`authenticateWithCode({ clientId, code, codeVerifier })`.

For confidential clients, use the same flow with `new WorkOS('sk_...')` on the
server. When `authenticateWithCode()` receives `codeVerifier`, it sends both
`client_secret` and `code_verifier`.

### Refresh and token validation

`CookieSession.refresh()` distinguishes transient from terminal failures so
callers can decide whether to retry. From v10.14.0, a successful refresh
returns refreshed `user` and `impersonator`; use them to update the application
session. Set the optional `issuer` in session token validation options to
require tokens from that issuer.

The Node SDK's User Management module exposes `verifyAccessToken()` from v12.0.0.
From v12.3.0,
`getLogoutUrl()` can build a logout URL after the session access token expires.
The Sessions API lists active sessions or revokes a session by ID.

Check for `totp` before reading it on listed `AuthenticationFactor` values.
User Management `getAuthorizationUrl()` supports `max_age` and
`invitationToken`; User Management APIs also accept `signalsId`.

## AuthKit for Next.js quick reference

### Server setup and route protection

Configure `WORKOS_CLIENT_ID`, `WORKOS_API_KEY`, and a `WORKOS_COOKIE_PASSWORD`
of at least 32 characters. Set `NEXT_PUBLIC_WORKOS_REDIRECT_URI` to the
registered callback URL and export `handleAuth()` as that route's `GET` handler.
The proxy's `redirectUri` overrides the environment callback URL.
`handleAuth({ baseURL: 'https://app.example.com' })` sets the public redirect
origin when the incoming request uses an internal hostname.

Use `authkitProxy()` in `proxy.ts` on Next.js 16+ and `authkitMiddleware()` in
`middleware.ts` on Next.js 15 and earlier. `middlewareAuth.enabled` requires
sign-in for matched routes except `unauthenticatedPaths`, using Next.js matcher
syntax. `signUpPaths` requests the sign-up screen for selected redirecting paths.

### Response headers and caching

`authkit(request)` returns `session`, `headers`, and `authorizationUrl`.
Use `handleAuthkitHeaders(request, headers, { redirect: authorizationUrl })`
for redirects and `handleAuthkitHeaders(request, headers)` to continue.
For rewrites, pass `partitionAuthkitHeaders(request, headers).requestHeaders`
to `NextResponse.rewrite()` as request headers, then apply `responseHeaders`
with `applyResponseHeaders(response, responseHeaders)`.

A session cookie, an `Authorization` header, or an active authenticated session
triggers cache protection. Preserve `Cache-Control` with `private` and
`no-store`, `Vary: Cookie`, and `x-middleware-cache: no-cache` through custom
response logic and the CDN.

### Client session and token lifecycle

Seed `AuthKitProvider` from server-side `withAuth()` using the session without
the access token as `initialAuth` to avoid an auth server action on mount.
Switch organizations with `refreshSession({ organizationId })` in a server
action or route handler, or `useAuth().refreshAuth({ organizationId })` in a
client component. The client exposes unauthorized-switch errors on `result?.error`.

`useAccessToken()` automatically refreshes tokens before expiry and exposes
`accessToken`, `loading`, `error`, and `refresh()`, resolving to
`string | undefined`. Its refresh updates the auth session;
`useAuth().refreshAuth()` updates the hook's token.

For a browser integration needing the token on first render, set
`eagerAuth: true`. On initial page loads, the proxy sets a JavaScript-readable
30-second cookie that the client consumes and immediately deletes.

In an App Router handler, `const { apiKey } = await validateApiKey()` validates
the incoming bearer API key. Return a 401 when `apiKey` is absent.

## AuthKit for browser React quick reference

Configure the callback Redirect URI and the app origin under allowed origins.
For dashboard impersonation and external login flows, also register `/login`
as the sign-in endpoint and have that route call `signIn()` inside `AuthKitProvider`.

React accepts object state, such as `signIn({ state: { returnTo: '/dashboard' } })`,
read through `onRedirectCallback(({ state }) => …)`. Next.js `getSignInUrl()`
and `getSignUpUrl()` instead accept application `state` as a string.

`devMode` stores tokens in `localStorage` and is automatically enabled on
`localhost` and `127.0.0.1`. Set `refreshBufferInterval` in seconds before
expiry; return `false` from `onBeforeAutoRefresh` to skip automatic refresh.
`getAccessToken()` refreshes as needed and throws `LoginRequiredError` when
no user is authenticated. `getClaims(accessToken)` decodes token claims.

Switch organizations with `await switchToOrganization({ organizationId, signInOpts })`;
`signInOpts` is optional. `useAuth()` exposes `isLoading` during initialization.

## Authorization and platform quick reference

Group role assignments expose `source` for grants that come from groups.
AuthKit organization memberships support multiple roles, including identity-provider
assignments through SSO and Directory Sync. IT admins can map identity-provider
groups to roles during SSO setup in the Admin Portal.

Use the feature flags runtime client for local evaluation from v8.11.0 and
custom targets from v10.11.0. v12.0.0 evaluates rules in order and continues
polling after errors without an error listener. Check rule and target management
calls against the updated v12.3.0 contracts; polling then reports timeouts and
cancels abandoned requests.

From v12.3.0, set organization API-key expiration with `expiresAt` in
`createOrganizationApiKey()`. Associate Admin Portal links with `externalUserId`
in `adminPortal.generateLink()` and invalidate them with `adminPortal.revokeLink()`.

From v12.2.0, use `connect.exchangeToken()` for RFC 8693 OAuth token exchange.
Node SDK v12.1.0 adds Pipes `finishConnection()`; from v12.2.0, read `state` from
`authorizeDataIntegration()` results. Pipes MCP grants agents time-limited
access to third-party data connections.

From v12.4.0, use `sso.authorizeLogout()` for relying-party-initiated Single
Logout and `sso.listConnections({ state })` to filter connections by state.
Azure Entra ID SCIM does not expand deeply nested group memberships; provision
them through groups exposing the required members directly if Directory Sync
must pick up those memberships.

Files in this skill

  • SKILL.md5.9 KB
  • references/authkit-nextjs.md4.9 KB
  • references/authkit-react.md1.8 KB
  • references/node-sdk-v8.md3.5 KB
  • references/sdk-python-go.md1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.