Skip to content

Commit

Permalink
Remove deprecated Node SDK references (#1880)
Browse files Browse the repository at this point in the history
Co-authored-by: victoria <[email protected]>
Co-authored-by: Alexis Aguilar <[email protected]>
  • Loading branch information
3 people authored Jan 21, 2025
1 parent 66f1523 commit 486edfc
Show file tree
Hide file tree
Showing 29 changed files with 257 additions and 508 deletions.
85 changes: 85 additions & 0 deletions docs/_partials/clerk-middleware-options.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
The `clerkMiddleware()` function accepts an optional object. The following options are available:

<Properties>
- `audience?`
- `string | string[]`

A string or list of [audiences](https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3). If passed, it is checked against the `aud` claim in the token.

---

- `authorizedParties?`
- `string[]`

An allowlist of origins to verify against, to protect your application from the subdomain cookie leaking attack.<br />For example: `['http://localhost:3000', 'https://example.com']`

---

- `clockSkewInMs?`
- `number`

Specifies the allowed time difference (in milliseconds) between the Clerk server (which generates the token) and the clock of the user's application server when validating a token. Defaults to 5000 ms (5 seconds).

---

- `domain?`
- `string`

The domain used for satellites to inform Clerk where this application is deployed.

---

- `isSatellite?`
- `boolean`

When using Clerk's satellite feature, this should be set to `true` for secondary domains.

---

- `jwtKey`
- `string`

Used to verify the session token in a networkless manner. Supply the PEM public key from the **[**API keys**](https://dashboard.clerk.com/last-active?path=api-keys) page -> Show JWT public key -> PEM Public Key** section in the Clerk Dashboard. **It's recommended to use [the environment variable](/docs/deployments/clerk-environment-variables) instead.** For more information, refer to [Manual JWT verification](/docs/backend-requests/handling/manual-jwt).

---

- `organizationSyncOptions?`
- <code>[OrganizationSyncOptions](#organization-sync-options) | undefined</code>

Used to activate a specific [organization](/docs/organizations/overview) or [personal account](/docs/organizations/organization-workspaces#organization-workspaces-in-the-clerk-dashboard:~:text=Personal%20account) based on URL path parameters. If there's a mismatch between the active organization in the session (e.g., as reported by [`auth()`](/docs/references/nextjs/auth)) and the organization indicated by the URL, the middleware will attempt to activate the organization specified in the URL.

---

- `proxyUrl?`
- `string`

Specify the URL of the proxy, if using a proxy.

---

- `signInUrl?`
- `string`

An alternative sign in URL.

---

- `signUpUrl?`
- `string`

An alternative sign up URL.

---

- `publishableKey`
- `string`

The Clerk Publishable Key for your instance. This can be found on the [**API keys**](https://dashboard.clerk.com/last-active?path=api-keys) page in the Clerk Dashboard.

---

- `secretKey?`
- `string`

The Clerk Secret Key for your instance. This can be found on the [**API keys**](https://dashboard.clerk.com/last-active?path=api-keys) page in the Clerk Dashboard. The `CLERK_ENCRYPTION_KEY` environment variable must be set when providing `secretKey` as an option, refer to [Dynamic keys](#dynamic-keys).
</Properties>
6 changes: 3 additions & 3 deletions docs/_partials/fastify/get-auth.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The following example uses `getAuth()` to protect a route and load the user's data. If the user is authenticated, their `userId` is passed to [`clerkClient.users.getUser()`](/docs/references/backend/user/get-user){{ target: '_blank' }} to get the current user's [`User`](/docs/references/javascript/user/user){{ target: '_blank' }} object. If not authenticated, the request is rejected with a `403` status code.
The following example uses `getAuth()` to protect a route and load the user's data. If the user is authenticated, their `userId` is passed to [`clerkClient.users.getUser()`](/docs/references/backend/user/get-user){{ target: '_blank' }} to get the current user's [`User`](/docs/references/javascript/user/user){{ target: '_blank' }} object. If not authenticated, the request is rejected with a `401` status code.

```ts
// dotenv must be imported before @clerk/fastify
Expand All @@ -16,9 +16,9 @@ fastify.get('/protected', async (request, reply) => {
// Use `getAuth()` to get the user's ID
const { userId } = getAuth(request)

// If user isn't authenticated, return a 403 error
// If user isn't authenticated, return a 401 error
if (!userId) {
return reply.code(403).send({ error: 'Unauthorized request' })
return reply.code(401).send({ error: 'User not authenticated' })
}

// Use `clerkClient` to access Clerk's Backend SDK methods
Expand Down
2 changes: 2 additions & 0 deletions docs/_partials/upgrade-node-express.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> [!IMPORTANT]
> The Node SDK is no longer supported. [Upgrade to the Express SDK](/docs/upgrade-guides/node-to-express).
3 changes: 1 addition & 2 deletions docs/backend-requests/handling/nodejs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ title: Handling requests with the Node SDK
description: Learn how to handle authenticated requests with Clerk's Node SDK.
---

> [!CAUTION]
> On January 8, 2025, the Node SDK will no longer be available. [Upgrade to the Express SDK](/docs/upgrade-guides/node-to-express).
<Include src="_partials/upgrade-node-express.mdx" />

## Node SDK Middleware

Expand Down
6 changes: 3 additions & 3 deletions docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ Find all the guides and resources you need to develop with Clerk.
## Explore by backend framework

<Cards variant="plain" cols={3}>
- [Node / Express](/docs/references/nodejs/overview)
- Quickly add authentication and user management to your Node.js application.
- {<svg viewBox="0 0 32 32" fill="none"><path fill="#393" d="M15.997 32c-.428 0-.854-.112-1.23-.33l-3.914-2.316c-.584-.326-.298-.442-.107-.51.78-.27.938-.334 1.771-.806.087-.049.202-.03.29.023l3.009 1.785c.11.06.262.06.362 0l11.727-6.768a.37.37 0 0 0 .179-.317V9.228a.378.378 0 0 0-.183-.323L16.18 2.143a.37.37 0 0 0-.361 0L4.098 8.907a.379.379 0 0 0-.184.32v13.534c0 .13.072.252.185.314l3.212 1.855c1.743.872 2.81-.154 2.81-1.186V10.383c0-.19.152-.338.342-.338h1.486c.186 0 .34.15.34.338v13.36c0 2.328-1.266 3.66-3.471 3.66-.678 0-1.212 0-2.702-.734L3.04 24.9a2.474 2.474 0 0 1-1.23-2.138V9.228c0-.879.471-1.7 1.23-2.137L14.767.315a2.567 2.567 0 0 1 2.463 0L28.956 7.09a2.475 2.475 0 0 1 1.232 2.137V22.76a2.48 2.48 0 0 1-1.232 2.139L17.23 31.67c-.373.218-.798.33-1.233.33Zm9.468-13.343c0-2.533-1.712-3.208-5.316-3.684-3.641-.481-4.012-.73-4.012-1.583 0-.704.314-1.644 3.01-1.644 2.41 0 3.298.52 3.664 2.143a.338.338 0 0 0 .329.266h1.521a.346.346 0 0 0 .248-.108.342.342 0 0 0 .09-.262c-.236-2.797-2.095-4.101-5.851-4.101-3.344 0-5.339 1.41-5.339 3.777 0 2.567 1.984 3.276 5.194 3.594 3.84.375 4.137.937 4.137 1.692 0 1.31-1.052 1.869-3.523 1.869-3.102 0-3.785-.779-4.015-2.323a.34.34 0 0 0-.337-.287H13.75a.336.336 0 0 0-.338.338c0 1.976 1.074 4.33 6.206 4.33 3.717.002 5.848-1.46 5.848-4.017Z"/></svg>}
- [Express](/docs/references/express/overview)
- Quickly add authentication and user management to your Express application.
- {<svg viewBox="0 0 20 20" style={{ fill: 'var(--light, black) var(--dark, white)' }}><path strokeWidth="0" d="M7.203 7.745c1.176 0 1.45 1.032 1.45 1.686H5.6c.082-.725.546-1.686 1.603-1.686z"></path><path strokeWidth="0" fillRule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm-2.44-5.833c-1.057 0-1.95-.582-1.971-1.993l4.025.01c.033-.16.05-.324.047-.488C9.661 8.64 9.164 7 7.297 7 5.61 7 4.589 8.39 4.589 10.1c0 1.71 1.062 2.9 2.828 2.9a4.591 4.591 0 001.912-.38l-.179-.75a3.72 3.72 0 01-1.59.297zm4.666-3.824l-.819-1.223h-1.164l1.95 2.804-2.044 2.933H11.3l.832-1.283c.071-.118.14-.23.209-.34.137-.22.269-.431.395-.67h.025l.018.03c.196.33.383.645.6.98l.854 1.283h1.177l-2.02-2.969 1.96-2.768h-1.14l-.796 1.211c-.076.126-.155.25-.234.376-.117.185-.235.372-.348.563h-.024l-.132-.218c-.141-.233-.28-.464-.45-.71z" clipRule="evenodd"></path></svg>}

---

Expand Down
73 changes: 24 additions & 49 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -764,10 +764,6 @@
{
"title": "Manual JWT Verification",
"href": "/docs/backend-requests/handling/manual-jwt"
},
{
"title": "Node.js (deprecated)",
"href": "/docs/backend-requests/handling/nodejs"
}
]
]
Expand Down Expand Up @@ -2373,77 +2369,56 @@
]
},
{
"title": "iOS",
"tag": "(Beta)",
"title": "Express",
"collapse": true,
"icon": "apple",
"icon": "expressjs",
"items": [
[
{
"title": "Overview",
"href": "/docs/references/ios/overview"
},
{
"title": "`getToken()`",
"href": "/docs/references/ios/get-token"
},
{
"title": "Guides",
"items": [
[
{
"title": "Sign in with Apple",
"href": "/docs/references/ios/sign-in-with-apple"
}
]
]
"href": "/docs/references/express/overview"
}
]
]
},
{
"title": "Node.js",
"title": "Fastify",
"collapse": true,
"icon": "nodejs",
"icon": "fastify",
"items": [
[
{
"title": "Overview",
"href": "/docs/references/nodejs/overview"
},
{
"title": "Available methods",
"href": "/docs/references/nodejs/available-methods"
},
{
"title": "Connect/Express Middleware",
"href": "/docs/backend-requests/handling/nodejs"
"href": "/docs/references/fastify/overview"
}
]
]
},
{
"title": "Express",
"title": "iOS",
"tag": "(Beta)",
"collapse": true,
"icon": "expressjs",
"icon": "apple",
"items": [
[
{
"title": "Overview",
"href": "/docs/references/express/overview"
}
]
]
},
{
"title": "Fastify",
"collapse": true,
"icon": "fastify",
"items": [
[
"href": "/docs/references/ios/overview"
},
{
"title": "Overview",
"href": "/docs/references/fastify/overview"
"title": "`getToken()`",
"href": "/docs/references/ios/get-token"
},
{
"title": "Guides",
"items": [
[
{
"title": "Sign in with Apple",
"href": "/docs/references/ios/sign-in-with-apple"
}
]
]
}
]
]
Expand Down
4 changes: 2 additions & 2 deletions docs/quickstarts/express.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Learn how to integrate Clerk into your Express backend for secure user authentic

The [`clerkMiddleware()`](/docs/references/express/overview#clerk-middleware) function checks the request's cookies and headers for a session JWT and, if found, attaches the [`Auth`](/docs/references/backend/types/auth-object#auth-object){{ target: '_blank' }} object to the `request` object under the `auth` key.

```ts {{ filename: 'index.ts', mark: [3, 7] }}
```ts {{ filename: 'index.ts', mark: [3, 8] }}
import 'dotenv/config'
import express from 'express'
import { clerkMiddleware } from '@clerk/express'
Expand All @@ -114,7 +114,7 @@ Learn how to integrate Clerk into your Express backend for secure user authentic

In the following example, `requireAuth()` is used to protect the `/protected` route. If the user isn't authenticated, they're redirected to the homepage. If the user is authenticated, the [`getAuth()`](/docs/references/express/overview#get-auth) function is used to get the `userId`, which is passed to [`clerkClient.users.getUser()`](/docs/references/backend/user/get-user){{ target: '_blank' }} to fetch the current user's `User` object.

```ts {{ filename: 'index.ts', mark: [3, [7, 11], [13, 16]] }}
```ts {{ filename: 'index.ts' }}
import 'dotenv/config'
import express from 'express'
import { clerkClient, requireAuth } from '@clerk/express'
Expand Down
6 changes: 6 additions & 0 deletions docs/quickstarts/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ description: See the getting started guides and tutorials.
## Backend

<Cards>
- [Express](/docs/quickstarts/express)
- Easily add secure, beautiful, and fast authentication to your Express application with Clerk.
- {<svg viewBox="0 0 20 20" style={{ fill: 'var(--light, black) var(--dark, white)' }}><path strokeWidth="0" d="M7.203 7.745c1.176 0 1.45 1.032 1.45 1.686H5.6c.082-.725.546-1.686 1.603-1.686z"></path><path strokeWidth="0" fillRule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm-2.44-5.833c-1.057 0-1.95-.582-1.971-1.993l4.025.01c.033-.16.05-.324.047-.488C9.661 8.64 9.164 7 7.297 7 5.61 7 4.589 8.39 4.589 10.1c0 1.71 1.062 2.9 2.828 2.9a4.591 4.591 0 001.912-.38l-.179-.75a3.72 3.72 0 01-1.59.297zm4.666-3.824l-.819-1.223h-1.164l1.95 2.804-2.044 2.933H11.3l.832-1.283c.071-.118.14-.23.209-.34.137-.22.269-.431.395-.67h.025l.018.03c.196.33.383.645.6.98l.854 1.283h1.177l-2.02-2.969 1.96-2.768h-1.14l-.796 1.211c-.076.126-.155.25-.234.376-.117.185-.235.372-.348.563h-.024l-.132-.218c-.141-.233-.28-.464-.45-.71z" clipRule="evenodd"></path></svg>}

---

- [Fastify](/docs/quickstarts/fastify)
- Easily add secure, beautiful, and fast authentication to your Fastify application with Clerk.
- {<svg viewBox="0 0 67 67" style={{ fill: 'var(--light, #000020) var(--dark, white)' }}><path d="M64.8923 18.1168L67 12.6535L66.9135 12.3157L46.0513 17.8069C48.2763 14.5882 47.5114 12.0059 47.5114 12.0059C47.5114 12.0059 40.8477 16.2604 35.8059 16.1515C30.7698 16.0398 29.1422 14.6998 21.4149 17.1621C13.6875 19.6243 11.5017 27.1842 9.26833 28.8117C7.02383 30.4392 0 35.7267 0 35.7267L0.01675 35.8216L6.35383 33.8004C6.35383 33.8004 4.61742 35.4335 0.924042 40.4167L0.750958 40.2575L0.756542 40.2882C0.756542 40.2882 3.72688 44.8275 6.63858 43.9844C6.97866 43.8773 7.30846 43.74 7.62404 43.574C8.79375 44.2273 10.3236 44.8666 12.0125 45.0397C12.0125 45.0397 10.868 43.7136 9.91321 42.2005L10.5776 41.7706L12.9924 42.6584L12.7244 40.3915C12.7328 40.3831 12.7412 40.3832 12.7468 40.3748L15.1169 41.243L14.8238 39.1827C15.1186 39.0262 15.4184 38.8791 15.7227 38.7417L18.1933 29.4035L28.4164 22.4327L27.604 24.479C25.5354 29.5766 21.6438 30.777 21.6438 30.777L20.019 31.3912C18.8103 32.8205 18.305 33.1695 17.8862 37.96C18.8577 37.7143 19.7901 37.6613 20.6332 37.8818C24.9994 39.0571 26.5153 44.3222 25.3372 45.7739C25.0468 46.1368 24.3433 46.7621 23.4584 47.4963H21.6913L21.6689 48.9312L21.4875 49.0736H19.6868L19.6617 50.4806L19.1871 50.8351C17.4926 50.8659 15.3542 49.3891 15.3542 49.3891C15.3542 50.7319 16.4736 52.8089 16.4736 52.8089L16.669 52.7139L16.4988 52.8396C16.4988 52.8396 21.0352 55.8629 23.8855 54.7407C26.4259 53.7469 32.9947 48.5627 38.6702 46.1061L55.8389 41.5836L58.103 35.7211L45.0156 39.1688V33.8953L60.3698 29.853L62.6338 23.9905L45.0184 28.6302V23.3568L64.8923 18.1168ZM33.7289 29.2835L37.802 28.2115L37.8578 28.4181L36.5876 31.7094L32.3638 32.8205L33.7289 29.2835ZM35.1331 36.3352L30.9121 37.4463L32.2773 33.9121L36.3503 32.8373L36.4061 33.0439L35.1331 36.3352ZM40.6355 35.1516L36.4117 36.2626L37.7796 32.7284L41.8527 31.6536L41.9085 31.8574L40.6355 35.1516Z"/></svg>}
Expand Down
2 changes: 1 addition & 1 deletion docs/references/astro/clerk-middleware.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ export const onRequest = clerkMiddleware((auth, context) => {

## `clerkMiddleware()` options

The `clerkMiddleware()` function accepts an optional object. See the full list of options available [here](/docs/references/nextjs/clerk-middleware#clerk-middleware-options.){{ target: '_blank' }}
<Include src="_partials/clerk-middleware-options" />
Loading

0 comments on commit 486edfc

Please sign in to comment.