From ed55d155de7f540ba85f482aae5e16935b89f02c Mon Sep 17 00:00:00 2001 From: Sarah Soutoul Date: Mon, 30 Nov 2026 11:13:31 +0000 Subject: [PATCH 01/12] docs(backend): correct Directory Sync prerequisite --- packages/backend/src/api/endpoints/OrganizationApi.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/api/endpoints/OrganizationApi.ts b/packages/backend/src/api/endpoints/OrganizationApi.ts index d1ee8d859e2..c9893c76347 100644 --- a/packages/backend/src/api/endpoints/OrganizationApi.ts +++ b/packages/backend/src/api/endpoints/OrganizationApi.ts @@ -72,8 +72,9 @@ export type UpdateParams = { */ selfServeSsoEnabled?: boolean; /** - * Lets Organization admins set up Directory Sync in ``. Requires self-serve - * SSO for the Organization, an SSO connection, and a [Pro or Business plan](/pricing) in production. + * Lets Organization admins set up Directory Sync in ``. Requires the instance's + * self-serve SSO and Directory Sync features, an SSO connection, and a + * [Pro or Business plan](/pricing) in production. */ selfServeDirectorySyncEnabled?: boolean; /** The name to update the Organization with. */ From de30434f4b25ccf327b40dd26ce83dbd3cc8daa3 Mon Sep 17 00:00:00 2001 From: Sarah Soutoul Date: Mon, 30 Nov 2026 11:13:38 +0000 Subject: [PATCH 02/12] docs(backend): qualify verifyToken JWKS fallback --- packages/backend/src/tokens/verify.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/tokens/verify.ts b/packages/backend/src/tokens/verify.ts index 691959e72ed..737e824be7d 100644 --- a/packages/backend/src/tokens/verify.ts +++ b/packages/backend/src/tokens/verify.ts @@ -45,7 +45,7 @@ export type VerifyTokenOptions = Simplify< * > [!WARNING] * > This is a lower-level method intended for more advanced use-cases. It's recommended to use [`authenticateRequest()`](https://clerk.com/docs/reference/backend/authenticate-request), which fully authenticates a token passed from the `request` object. * - * Verifies a Clerk-generated token signature. Networkless if the `jwtKey` is provided and its key type matches the token's `alg`. Otherwise, performs a network call to retrieve the JWKS from the [Backend API](https://clerk.com/docs/reference/backend-api/tag/jwks/GET/jwks){{ target: '_blank' }}. + * Verifies a Clerk-generated token signature. Verification is networkless when `jwtKey` is provided and its key type matches the token's `alg`. Otherwise, it uses the JWKS from the [Backend API](https://clerk.com/docs/reference/backend-api/tag/jwks/GET/jwks){{ target: '_blank' }} if `secretKey` is provided; without a usable `jwtKey` or `secretKey`, verification fails. * * @param token - The token to verify. * @param options - Options for verifying the token. It is recommended to set these options as [environment variables](/docs/guides/development/clerk-environment-variables#api-and-sdk-configuration) where possible, and then pass them to the function. For example, you can set the `secretKey` option using the `CLERK_SECRET_KEY` environment variable, and then pass it to the function like this: `verifyToken(token, { secretKey: process.env.CLERK_SECRET_KEY })`. From d88dd76a76e459bcea9f574687f697cd38f7cbc5 Mon Sep 17 00:00:00 2001 From: Sarah Soutoul Date: Mon, 30 Nov 2026 11:13:45 +0000 Subject: [PATCH 03/12] docs(backend): add changeset for reference corrections --- .changeset/correct-backend-reference-prerequisites.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/correct-backend-reference-prerequisites.md diff --git a/.changeset/correct-backend-reference-prerequisites.md b/.changeset/correct-backend-reference-prerequisites.md new file mode 100644 index 00000000000..b4aa5c0c922 --- /dev/null +++ b/.changeset/correct-backend-reference-prerequisites.md @@ -0,0 +1,5 @@ +--- +'@clerk/backend': patch +--- + +Correct the documented Directory Sync prerequisites for `updateOrganization()` and clarify when `verifyToken()` uses JWKS. From 94656f8799afa2e82ea9b819a6c0fcd17580f796 Mon Sep 17 00:00:00 2001 From: Sarah Soutoul Date: Mon, 30 Nov 2026 11:23:10 +0000 Subject: [PATCH 04/12] docs(backend): preserve verifyToken opening wording --- packages/backend/src/tokens/verify.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/tokens/verify.ts b/packages/backend/src/tokens/verify.ts index 737e824be7d..51661b3d0fd 100644 --- a/packages/backend/src/tokens/verify.ts +++ b/packages/backend/src/tokens/verify.ts @@ -45,7 +45,7 @@ export type VerifyTokenOptions = Simplify< * > [!WARNING] * > This is a lower-level method intended for more advanced use-cases. It's recommended to use [`authenticateRequest()`](https://clerk.com/docs/reference/backend/authenticate-request), which fully authenticates a token passed from the `request` object. * - * Verifies a Clerk-generated token signature. Verification is networkless when `jwtKey` is provided and its key type matches the token's `alg`. Otherwise, it uses the JWKS from the [Backend API](https://clerk.com/docs/reference/backend-api/tag/jwks/GET/jwks){{ target: '_blank' }} if `secretKey` is provided; without a usable `jwtKey` or `secretKey`, verification fails. + * Verifies a Clerk-generated token signature. Networkless if the `jwtKey` is provided and its key type matches the token's `alg`. Otherwise, it uses the JWKS from the [Backend API](https://clerk.com/docs/reference/backend-api/tag/jwks/GET/jwks){{ target: '_blank' }} if `secretKey` is provided; without a usable `jwtKey` or `secretKey`, verification fails. * * @param token - The token to verify. * @param options - Options for verifying the token. It is recommended to set these options as [environment variables](/docs/guides/development/clerk-environment-variables#api-and-sdk-configuration) where possible, and then pass them to the function. For example, you can set the `secretKey` option using the `CLERK_SECRET_KEY` environment variable, and then pass it to the function like this: `verifyToken(token, { secretKey: process.env.CLERK_SECRET_KEY })`. From 207bfbfaef64a98bfd16633f7038028df9182419 Mon Sep 17 00:00:00 2001 From: Sarah Soutoul Date: Wed, 2 Dec 2026 20:04:22 +0000 Subject: [PATCH 05/12] Update packages/backend/src/api/endpoints/OrganizationApi.ts Co-authored-by: Michael Novotny --- packages/backend/src/api/endpoints/OrganizationApi.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/api/endpoints/OrganizationApi.ts b/packages/backend/src/api/endpoints/OrganizationApi.ts index c9893c76347..84d0c4a62b1 100644 --- a/packages/backend/src/api/endpoints/OrganizationApi.ts +++ b/packages/backend/src/api/endpoints/OrganizationApi.ts @@ -72,9 +72,9 @@ export type UpdateParams = { */ selfServeSsoEnabled?: boolean; /** - * Lets Organization admins set up Directory Sync in ``. Requires the instance's - * self-serve SSO and Directory Sync features, an SSO connection, and a - * [Pro or Business plan](/pricing) in production. + * Lets Organization admins set up Directory Sync in ``. Requires Clerk + * Organizations to be enabled for the instance, an SSO connection, and a + * [Pro or Business plan](https://clerk.com/pricing) in production. */ selfServeDirectorySyncEnabled?: boolean; /** The name to update the Organization with. */ From b03c79730b91fee1204da1157e594ea96dc230ff Mon Sep 17 00:00:00 2001 From: Sarah Soutoul Date: Wed, 2 Dec 2026 20:04:47 +0000 Subject: [PATCH 06/12] Update packages/backend/src/tokens/verify.ts Co-authored-by: Michael Novotny --- packages/backend/src/tokens/verify.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/tokens/verify.ts b/packages/backend/src/tokens/verify.ts index 51661b3d0fd..4070386385a 100644 --- a/packages/backend/src/tokens/verify.ts +++ b/packages/backend/src/tokens/verify.ts @@ -45,7 +45,7 @@ export type VerifyTokenOptions = Simplify< * > [!WARNING] * > This is a lower-level method intended for more advanced use-cases. It's recommended to use [`authenticateRequest()`](https://clerk.com/docs/reference/backend/authenticate-request), which fully authenticates a token passed from the `request` object. * - * Verifies a Clerk-generated token signature. Networkless if the `jwtKey` is provided and its key type matches the token's `alg`. Otherwise, it uses the JWKS from the [Backend API](https://clerk.com/docs/reference/backend-api/tag/jwks/GET/jwks){{ target: '_blank' }} if `secretKey` is provided; without a usable `jwtKey` or `secretKey`, verification fails. + * Verifies a Clerk-generated token signature. Networkless if the `jwtKey` is provided and its key type matches the token's `alg`. When `jwtKey` is missing or its key type can't verify the token's `alg`, it retrieves the JWKS from the [Backend API](https://clerk.com/docs/reference/backend-api/tag/jwks/GET/jwks){{ target: '_blank' }} instead, which requires `secretKey`. * * @param token - The token to verify. * @param options - Options for verifying the token. It is recommended to set these options as [environment variables](/docs/guides/development/clerk-environment-variables#api-and-sdk-configuration) where possible, and then pass them to the function. For example, you can set the `secretKey` option using the `CLERK_SECRET_KEY` environment variable, and then pass it to the function like this: `verifyToken(token, { secretKey: process.env.CLERK_SECRET_KEY })`. From 85dad430ad55cf7ade9eb5f90d1f09c4c8418262 Mon Sep 17 00:00:00 2001 From: Sarah Soutoul Date: Wed, 2 Dec 2026 20:06:43 +0000 Subject: [PATCH 07/12] docs(backend): use absolute pricing link in SSO reference --- packages/backend/src/api/endpoints/OrganizationApi.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/api/endpoints/OrganizationApi.ts b/packages/backend/src/api/endpoints/OrganizationApi.ts index 84d0c4a62b1..0be26256abd 100644 --- a/packages/backend/src/api/endpoints/OrganizationApi.ts +++ b/packages/backend/src/api/endpoints/OrganizationApi.ts @@ -68,7 +68,7 @@ export type GetOrganizationParams = ( export type UpdateParams = { /** * Lets Organization admins set up enterprise SSO in ``. Requires Clerk - * Organizations to be enabled for the instance and a [Pro or Business plan](/pricing) in production. + * Organizations to be enabled for the instance and a [Pro or Business plan](https://clerk.com/pricing) in production. */ selfServeSsoEnabled?: boolean; /** From 57b9971aaf302a13481ad58260d556157ac7c1c4 Mon Sep 17 00:00:00 2001 From: Sarah Soutoul Date: Thu, 3 Dec 2026 16:59:30 +0000 Subject: [PATCH 08/12] docs(backend): clarify JWKS cache and secret key requirement --- .changeset/correct-backend-reference-prerequisites.md | 2 +- packages/backend/src/tokens/verify.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.changeset/correct-backend-reference-prerequisites.md b/.changeset/correct-backend-reference-prerequisites.md index e1595ff1d1f..a79a4eee169 100644 --- a/.changeset/correct-backend-reference-prerequisites.md +++ b/.changeset/correct-backend-reference-prerequisites.md @@ -2,4 +2,4 @@ '@clerk/backend': patch --- -Correct the documented Directory Sync prerequisites for `updateOrganization()`. +Correct the documented Directory Sync prerequisites for `updateOrganization()` and clarify the `secretKey` requirement when `verifyToken()` retrieves JWKS. diff --git a/packages/backend/src/tokens/verify.ts b/packages/backend/src/tokens/verify.ts index a3fa6f02fb4..cffbb870d5d 100644 --- a/packages/backend/src/tokens/verify.ts +++ b/packages/backend/src/tokens/verify.ts @@ -45,7 +45,8 @@ export type VerifyTokenOptions = Simplify< * > [!WARNING] * > This is a lower-level method intended for more advanced use-cases. It's recommended to use [`authenticateRequest()`](https://clerk.com/docs/reference/backend/authenticate-request), which fully authenticates a token passed from the `request` object. * - * Verifies a Clerk-generated token signature. Networkless if the `jwtKey` is provided. Otherwise, performs a network call to retrieve the JWKS from the [Backend API](https://clerk.com/docs/reference/backend-api/tag/jwks/GET/jwks){{ target: '_blank' }}. + * Verifies a Clerk-generated token signature. Networkless if the `jwtKey` is provided. + * Otherwise, performs a network call to retrieve the JWKS from the [Backend API](https://clerk.com/docs/reference/backend-api/tag/jwks/GET/jwks){{ target: '_blank' }} if the key is not cached; this requires `secretKey`. * * @param token - The token to verify. * @param options - Options for verifying the token. It is recommended to set these options as [environment variables](/docs/guides/development/clerk-environment-variables#api-and-sdk-configuration) where possible, and then pass them to the function. For example, you can set the `secretKey` option using the `CLERK_SECRET_KEY` environment variable, and then pass it to the function like this: `verifyToken(token, { secretKey: process.env.CLERK_SECRET_KEY })`. From 0dcdf8605d0b117d034301e3451c4446ee3300fc Mon Sep 17 00:00:00 2001 From: Sarah Soutoul Date: Thu, 3 Dec 2026 17:11:06 +0000 Subject: [PATCH 09/12] Fix formatting --- packages/backend/src/api/endpoints/OrganizationApi.ts | 7 ++----- packages/backend/src/tokens/verify.ts | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/backend/src/api/endpoints/OrganizationApi.ts b/packages/backend/src/api/endpoints/OrganizationApi.ts index 0be26256abd..e7b69887a69 100644 --- a/packages/backend/src/api/endpoints/OrganizationApi.ts +++ b/packages/backend/src/api/endpoints/OrganizationApi.ts @@ -67,14 +67,11 @@ export type GetOrganizationParams = ( /** @inline */ export type UpdateParams = { /** - * Lets Organization admins set up enterprise SSO in ``. Requires Clerk - * Organizations to be enabled for the instance and a [Pro or Business plan](https://clerk.com/pricing) in production. + * Lets Organization admins set up enterprise SSO in ``. Requires Clerk Organizations to be enabled for the instance and a [Pro or Business plan](https://clerk.com/pricing) in production. */ selfServeSsoEnabled?: boolean; /** - * Lets Organization admins set up Directory Sync in ``. Requires Clerk - * Organizations to be enabled for the instance, an SSO connection, and a - * [Pro or Business plan](https://clerk.com/pricing) in production. + * Lets Organization admins set up Directory Sync in ``. Requires Clerk Organizations to be enabled for the instance, an SSO connection, and a [Pro or Business plan](https://clerk.com/pricing) in production. */ selfServeDirectorySyncEnabled?: boolean; /** The name to update the Organization with. */ diff --git a/packages/backend/src/tokens/verify.ts b/packages/backend/src/tokens/verify.ts index cffbb870d5d..cba1a09dea2 100644 --- a/packages/backend/src/tokens/verify.ts +++ b/packages/backend/src/tokens/verify.ts @@ -45,8 +45,7 @@ export type VerifyTokenOptions = Simplify< * > [!WARNING] * > This is a lower-level method intended for more advanced use-cases. It's recommended to use [`authenticateRequest()`](https://clerk.com/docs/reference/backend/authenticate-request), which fully authenticates a token passed from the `request` object. * - * Verifies a Clerk-generated token signature. Networkless if the `jwtKey` is provided. - * Otherwise, performs a network call to retrieve the JWKS from the [Backend API](https://clerk.com/docs/reference/backend-api/tag/jwks/GET/jwks){{ target: '_blank' }} if the key is not cached; this requires `secretKey`. + * Verifies a Clerk-generated token signature. Networkless if the `jwtKey` is provided. Otherwise, performs a network call to retrieve the JWKS from the [Backend API](https://clerk.com/docs/reference/backend-api/tag/jwks/GET/jwks){{ target: '_blank' }} if the key is not cached; this requires `secretKey`. * * @param token - The token to verify. * @param options - Options for verifying the token. It is recommended to set these options as [environment variables](/docs/guides/development/clerk-environment-variables#api-and-sdk-configuration) where possible, and then pass them to the function. For example, you can set the `secretKey` option using the `CLERK_SECRET_KEY` environment variable, and then pass it to the function like this: `verifyToken(token, { secretKey: process.env.CLERK_SECRET_KEY })`. From 240845b80b64f5051bb02edaec55647a050d94dd Mon Sep 17 00:00:00 2001 From: Sarah Soutoul Date: Thu, 3 Dec 2026 17:20:58 +0000 Subject: [PATCH 10/12] docs(backend): clarify secret key requirement with cached JWKS --- packages/backend/src/tokens/verify.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/tokens/verify.ts b/packages/backend/src/tokens/verify.ts index cba1a09dea2..8213986a4ed 100644 --- a/packages/backend/src/tokens/verify.ts +++ b/packages/backend/src/tokens/verify.ts @@ -45,7 +45,7 @@ export type VerifyTokenOptions = Simplify< * > [!WARNING] * > This is a lower-level method intended for more advanced use-cases. It's recommended to use [`authenticateRequest()`](https://clerk.com/docs/reference/backend/authenticate-request), which fully authenticates a token passed from the `request` object. * - * Verifies a Clerk-generated token signature. Networkless if the `jwtKey` is provided. Otherwise, performs a network call to retrieve the JWKS from the [Backend API](https://clerk.com/docs/reference/backend-api/tag/jwks/GET/jwks){{ target: '_blank' }} if the key is not cached; this requires `secretKey`. + * Verifies a Clerk-generated token signature. Networkless if `jwtKey` is provided. Otherwise, `secretKey` is required, and a network call retrieves the JWKS from the [Backend API](https://clerk.com/docs/reference/backend-api/tag/jwks/GET/jwks){{ target: '_blank' }} if the key is not cached. * * @param token - The token to verify. * @param options - Options for verifying the token. It is recommended to set these options as [environment variables](/docs/guides/development/clerk-environment-variables#api-and-sdk-configuration) where possible, and then pass them to the function. For example, you can set the `secretKey` option using the `CLERK_SECRET_KEY` environment variable, and then pass it to the function like this: `verifyToken(token, { secretKey: process.env.CLERK_SECRET_KEY })`. From 5de14ca54206d98d96313d965526853819b7a68b Mon Sep 17 00:00:00 2001 From: Sarah Soutoul Date: Thu, 3 Dec 2026 17:21:10 +0000 Subject: [PATCH 11/12] docs(backend): align changeset with cached JWKS behavior --- .changeset/correct-backend-reference-prerequisites.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/correct-backend-reference-prerequisites.md b/.changeset/correct-backend-reference-prerequisites.md index a79a4eee169..f304ed455b2 100644 --- a/.changeset/correct-backend-reference-prerequisites.md +++ b/.changeset/correct-backend-reference-prerequisites.md @@ -2,4 +2,4 @@ '@clerk/backend': patch --- -Correct the documented Directory Sync prerequisites for `updateOrganization()` and clarify the `secretKey` requirement when `verifyToken()` retrieves JWKS. +Correct the documented Directory Sync prerequisites for `updateOrganization()` and clarify that `verifyToken()` requires `secretKey` whenever `jwtKey` is omitted, including when JWKS is cached. From 3c782849d5554af8123fac5bdf06b34c1fa8c5f8 Mon Sep 17 00:00:00 2001 From: Michael Novotny Date: Thu, 3 Dec 2026 11:53:13 -0600 Subject: [PATCH 12/12] docs(backend): use active voice in verifyToken JWKS note Co-Authored-By: Claude Opus 5.5 --- packages/backend/src/tokens/verify.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/tokens/verify.ts b/packages/backend/src/tokens/verify.ts index 8213986a4ed..8535363aa6b 100644 --- a/packages/backend/src/tokens/verify.ts +++ b/packages/backend/src/tokens/verify.ts @@ -45,7 +45,7 @@ export type VerifyTokenOptions = Simplify< * > [!WARNING] * > This is a lower-level method intended for more advanced use-cases. It's recommended to use [`authenticateRequest()`](https://clerk.com/docs/reference/backend/authenticate-request), which fully authenticates a token passed from the `request` object. * - * Verifies a Clerk-generated token signature. Networkless if `jwtKey` is provided. Otherwise, `secretKey` is required, and a network call retrieves the JWKS from the [Backend API](https://clerk.com/docs/reference/backend-api/tag/jwks/GET/jwks){{ target: '_blank' }} if the key is not cached. + * Verifies a Clerk-generated token signature. Networkless if `jwtKey` is provided. Otherwise, it requires `secretKey` and makes a network call to retrieve the JWKS from the [Backend API](https://clerk.com/docs/reference/backend-api/tag/jwks/GET/jwks){{ target: '_blank' }} when the key isn't cached. * * @param token - The token to verify. * @param options - Options for verifying the token. It is recommended to set these options as [environment variables](/docs/guides/development/clerk-environment-variables#api-and-sdk-configuration) where possible, and then pass them to the function. For example, you can set the `secretKey` option using the `CLERK_SECRET_KEY` environment variable, and then pass it to the function like this: `verifyToken(token, { secretKey: process.env.CLERK_SECRET_KEY })`.