@clerk/backend
3.29.0 · 14 Nov 2026MIT8.4M / weekRepositoryHomepagenpmAtom feed
2.33.9 is the newest release of 2.x.
In short
1 breaking2 new2 fixed2 internal
- Breaking
Introduces machine authentication, supporting four token types:
api_key,oauth_token,machine_token, andsession_token. For backwards compatibility,session_tokenremains the default when no token type is specified. This enables machine-to-machine authentication and use cases such as API keys and OAuth integrations. Existing applications continue to work without modification.
Security
2 advisories affect 2.0.0; 2.33.3 fixes them
- HighClerk has an authorization bypass when combining organization, billing, or reverification checksGHSA-w24r-5266-9c3c · 30 Apr 2026Fixed in 2.33.3
- High@clerk/backend Performs Insufficient Verification of Data AuthenticityGHSA-9mp4-77wg-rwx9 · 9 Jul 2025Fixed in 2.4.0
Release note
Major Changes
- Breaking
Introduces machine authentication, supporting four token types:
api_key,oauth_token,machine_token, andsession_token. For backwards compatibility,session_tokenremains the default when no token type is specified. This enables machine-to-machine authentication and use cases such as API keys and OAuth integrations. Existing applications continue to work without modification.You can specify which token types are allowed by using the
acceptsTokenoption in theauthenticateRequest()function. This option can be set to a specific type, an array of types, or'any'to accept all supported tokens.Example usage:
import express from 'express'; import { createClerkClient } from '@clerk/backend'; const app = express(); const clerkClient = createClerkClient({ secretKey: 'sk_xxx', publishableKey: 'pk_xxx' }); app.use(async (req, res, next) => { const requestState = await clerkClient.authenticateRequest(req, { acceptsToken: 'any', }); if (!requestState.isAuthenticated) { // do something for unauthenticated requests } const authObject = requestState.toAuth(); if (authObject.tokenType === 'session_token') { console.log('this is session token from a user'); } else { console.log('this is some other type of machine token'); console.log('more specifically, a ' + authObject.tokenType); } // Attach the auth object to locals so downstream handlers // and middleware can access it res.locals.auth = authObject; next(); });
Minor Changes
The
svixdependency is no longer needed when using theverifyWebhook()function.verifyWebhook()was refactored to not rely onsvixanymore while keeping the same functionality and behavior.If you previously installed
svixto useverifyWebhook()you can uninstall it now:npm uninstall svix
Patch Changes
Improve JSDoc comments for verifyWebhook and verifyToken
Improve JSDoc comments
Introduce
getAuthObjectFromJwtas internal utility function that centralizes the logic for generating auth objects from session JWTs.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.