Skip to content

Commit 1edb744

Browse files
committed
changing backend requests section to session requests
editing session requests slightly
1 parent 1b9a94e commit 1edb744

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+122
-126
lines changed

docs/_partials/clerk-middleware-options.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The `clerkMiddleware()` function accepts an optional object. The following optio
3939
- `jwtKey`
4040
- `string`
4141

42-
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).
42+
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/session-requests/handling/manual-jwt).
4343

4444
---
4545

docs/_partials/clerk-options.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- `jwtKey?`
1010
- `string`
1111

12-
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. For more information, refer to [Manual JWT verification](/docs/backend-requests/handling/manual-jwt).
12+
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. For more information, refer to [Manual JWT verification](/docs/session-requests/handling/manual-jwt).
1313

1414
---
1515

docs/_partials/token-size-callout.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
> [!CAUTION]
22
> The entire session token has a max size of 4kb. Exceeding this size can have adverse effects, including a possible infinite redirect loop for users who exceed this size in Next.js applications.
33
> It's recommended to move particularly large claims out of the JWT and fetch these using a separate API call from your backend.
4-
> [Learn more](/docs/backend-requests/resources/session-tokens#size-limitations).
4+
> [Learn more](/docs/session-requests/session-tokens#size-limitations).

docs/authentication/configuration/session-options.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@ There are two main ways to add the multi-session feature to your application:
7575

7676
## Customize session token
7777

78-
Session tokens are JWTs that contain a set of [default claims](/docs/backend-requests/resources/session-tokens) required by Clerk. You can customize these tokens by providing additional claims of your own.
78+
Session tokens are JWTs that contain a set of [default claims](/docs/session-requests/session-tokens) required by Clerk. You can customize these tokens by providing additional claims of your own.
7979

80-
To learn how to customize session tokens, see the [dedicated guide](/docs/backend-requests/making/custom-session-token).
80+
To learn how to customize session tokens, see the [dedicated guide](/docs/session-requests/making/custom-session-token).

docs/backend-requests/handling/nodejs.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ These options can be used with both [`ClerkExpressWithAuth`](#clerk-express-with
179179
- `jwtKey`
180180
- `string`
181181

182-
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).
182+
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/session-requests/handling/manual-jwt).
183183

184184
---
185185

docs/deployments/clerk-cookies.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ These cookies:
1111

1212
- Are required for Clerk to function, and should not be blocked by you or your users.
1313
- Do not store any personally identifiable information by default.
14-
- Can be configured by modifying the [session token](/docs/backend-requests/resources/session-tokens) in the [Clerk Dashboard](https://dashboard.clerk.com/last-active?path=jwt-templates).
14+
- Can be configured by modifying the [session token](/docs/session-requests/session-tokens) in the [Clerk Dashboard](https://dashboard.clerk.com/last-active?path=jwt-templates).
1515

1616
| Cookie Subgroup | Cookies | More Information |
1717
| - | - | - |

docs/deployments/clerk-environment-variables.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ The following environment variables enable you to configure API and SDK behavior
7777
| `CLERK_JS_VERSION` | Sets the npm version for `@clerk/clerk-js`. |
7878
| `CLERK_API_URL` | Sets the Clerk API URL for debugging. Defaults to `"https://api.clerk.com"` |
7979
| `CLERK_API_VERSION` | Sets the version of the Clerk API to use. Defaults to `"v1"` |
80-
| `CLERK_JWT_KEY` | Sets the JWT verification key that Clerk will use to provide networkless JWT session token verification. Refer to [Manual JWT verification](/docs/backend-requests/handling/manual-jwt). |
80+
| `CLERK_JWT_KEY` | Sets the JWT verification key that Clerk will use to provide networkless JWT session token verification. Refer to [Manual JWT verification](/docs/session-requests/handling/manual-jwt). |
8181
| `CLERK_FAPI` | Sets the URL to your Clerk apps' Frontend API. |
8282
| `CLERK_PROXY_URL` | Sets the URL for your proxy. |
8383
</Tab>
@@ -92,7 +92,7 @@ The following environment variables enable you to configure API and SDK behavior
9292
| `NEXT_PUBLIC_CLERK_FAPI` | Sets the URL to your Clerk app's Frontend API. |
9393
| `NEXT_PUBLIC_CLERK_PROXY_URL` | Sets the URL for your proxy. |
9494
| `CLERK_ENCRYPTION_KEY` | Sets the encryption key to securely propagate `clerkMiddleware` dynamic keys during request time. A 128-bit, pseudorandom value should be used. See [Dynamic keys](/docs/references/nextjs/clerk-middleware#dynamic-keys) to learn more. |
95-
| `CLERK_JWT_KEY` | Sets the JWT verification key that Clerk will use to provide networkless JWT session token verification. Refer to [Manual JWT verification](/docs/backend-requests/handling/manual-jwt). |
95+
| `CLERK_JWT_KEY` | Sets the JWT verification key that Clerk will use to provide networkless JWT session token verification. Refer to [Manual JWT verification](/docs/session-requests/handling/manual-jwt). |
9696
</Tab>
9797
</Tabs>
9898

docs/deployments/migrate-from-firebase.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Migrating your user base from Firebase to Clerk is a 2-part process that can be
141141
```
142142

143143
> [!WARNING]
144-
> This implementation does not take rate limiting into account. If you have a large user base, you may want to implement a retry mechanism. Clerk will return a `429` status code if you exceed the rate limit. You can find more information about Clerk's rate limits [here](/docs/backend-requests/resources/rate-limits). Keep [Firebase's rate limits](https://firebase.google.com/docs/functions/quotas) in mind as well when exporting your users.
144+
> This implementation does not take rate limiting into account. If you have a large user base, you may want to implement a retry mechanism. Clerk will return a `429` status code if you exceed the rate limit. You can find more information about Clerk's rate limits [here](/docs/rate-limits). Keep [Firebase's rate limits](https://firebase.google.com/docs/functions/quotas) in mind as well when exporting your users.
145145
146146
Once the script has finished running, your user base will be fully migrated to Clerk.
147147
</Steps>

docs/deployments/migrate-overview.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Each of these have trade-offs you'll need to consider on behalf of for your appl
1212

1313
## Basic export / import
1414

15-
With basic export / import, you're taking an export from your previous tool and importing data into Clerk. The most common way to handle this is by making use of the [`CreateUser`](/docs/reference/backend-api/tag/Users#operation/CreateUser){{ target: '_blank' }} Backend API endpoint. It's important to note that the `CreateUser` endpoint is rate limited. For more information, see the [guide on rate limits](/docs/backend-requests/resources/rate-limits#backend-api-requests).
15+
With basic export / import, you're taking an export from your previous tool and importing data into Clerk. The most common way to handle this is by making use of the [`CreateUser`](/docs/reference/backend-api/tag/Users#operation/CreateUser){{ target: '_blank' }} Backend API endpoint. It's important to note that the `CreateUser` endpoint is rate limited. For more information, see the [guide on rate limits](/docs/rate-limits#backend-api-requests).
1616

1717
You'll also need to provide your `password_hasher` value (The hashing algorithm used to generate the password digest) and in some instances Clerk will transparently upgrade your users' password hashes to the more secure Bcrypt hashing algorithm. More details on this topic are available in the [Backend API reference docs](/docs/reference/backend-api/tag/Users#operation/CreateUser!path=password_hasher\&t=request){{ target: '_blank' }}.
1818

@@ -66,7 +66,7 @@ A trickle migration is great for upgrading active users and sessions to take adv
6666

6767
## Migration tools
6868

69-
To aid in basic migrations, Clerk provides an open-source script that takes a JSON file as input, containing a list of users, and creates a user in Clerk using the Backend API. The script respects the [backend rate limits](/docs/backend-requests/resources/rate-limits#backend-api-requests) and gracefully handles errors. We suggest you customize the [Zod schema](https://github.com/clerk/migration-script/blob/main/index.ts#L25-L43){{ target: '_blank' }} to your application's needs.
69+
To aid in basic migrations, Clerk provides an open-source script that takes a JSON file as input, containing a list of users, and creates a user in Clerk using the Backend API. The script respects the [backend rate limits](/docs/rate-limits#backend-api-requests) and gracefully handles errors. We suggest you customize the [Zod schema](https://github.com/clerk/migration-script/blob/main/index.ts#L25-L43){{ target: '_blank' }} to your application's needs.
7070

7171
To use Clerk's migration script, clone the [repository](https://github.com/clerk/migration-script) and follow the instructions in the `README`.
7272

docs/how-clerk-works/overview.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,13 @@ The client token serves as the source of truth for authentication state. When a
255255
### Session token
256256

257257
- **Cookie name:** `__session`
258-
- **Contents:** A Clerk-signed JWT containing [a set of default claims](/docs/backend-requests/resources/session-tokens#default-session-claims). Can be customized in the Clerk Dashboard to include additional claims.
259-
- **Domain:** Set on your application's domain directly, scoped strictly so it cannot be shared across subdomains. This is done to prevent a different app on a different subdomain from being able to take over your users' accounts. If you need to send the session token value across subdomain boundaries, such as from `example.com` to `api.example.com`, you can [put the token in a `request` header instead](/docs/backend-requests/making/cross-origin).
258+
- **Contents:** A Clerk-signed JWT containing [a set of default claims](/docs/session-requests/session-tokens#default-session-claims). Can be customized in the Clerk Dashboard to include additional claims.
259+
- **Domain:** Set on your application's domain directly, scoped strictly so it cannot be shared across subdomains. This is done to prevent a different app on a different subdomain from being able to take over your users' accounts. If you need to send the session token value across subdomain boundaries, such as from `example.com` to `api.example.com`, you can [put the token in a `request` header instead](/docs/session-requests/making/cross-origin).
260260
- **Expiration:** 60 seconds
261261
- **HttpOnly:** No - must be able to be accessed by client-side SDKs
262262
- **SameSite:** Lax
263263

264-
When your app makes a request from the frontend to your backend, if the backend is on the same origin, the `__session` cookie will automatically be sent along with the request. Your backend can then [cryptographically verify](/docs/backend-requests/handling/manual-jwt) the session token's signature and extract the user ID and other claims.
264+
When your app makes a request from the frontend to your backend, if the backend is on the same origin, the `__session` cookie will automatically be sent along with the request. Your backend can then [cryptographically verify](/docs/session-requests/handling/manual-jwt) the session token's signature and extract the user ID and other claims.
265265

266266
## The Handshake
267267

docs/how-clerk-works/tokens-signatures.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Let's decode and break down each part:
6262
}
6363
```
6464

65-
**Payload**: The payload contains the actual information that you want to send. In Clerk's case, this includes information about the authenticated user. [Read more about Clerk's session JWT payload](/docs/backend-requests/resources/session-tokens).
65+
**Payload**: The payload contains the actual information that you want to send. In Clerk's case, this includes information about the authenticated user. [Read more about Clerk's session JWT payload](/docs/session-requests/session-tokens).
6666

6767
```json
6868
{
@@ -77,7 +77,7 @@ Let's decode and break down each part:
7777
Error: The string is not correctly encoded
7878
```
7979

80-
When decoding the signature from base64, an error is thrown because the signature is not base64-encoded. This is expected behavior. The recipient must use the JWT issuer's public key and the algorithm specified in the header (e.g., RS256) to verify the signature. Clerk's SDKs all ship with a method for verifying the signature of a Clerk JWT: [`authenticateRequest()`](/docs/references/backend/authenticate-request). But if you'd like to verify the signature yourself, see the [guide on manual JWT verification](/docs/backend-requests/handling/manual-jwt).
80+
When decoding the signature from base64, an error is thrown because the signature is not base64-encoded. This is expected behavior. The recipient must use the JWT issuer's public key and the algorithm specified in the header (e.g., RS256) to verify the signature. Clerk's SDKs all ship with a method for verifying the signature of a Clerk JWT: [`authenticateRequest()`](/docs/references/backend/authenticate-request). But if you'd like to verify the signature yourself, see the [guide on manual JWT verification](/docs/session-requests/handling/manual-jwt).
8181

8282
### How Clerk uses JWTs
8383

docs/integrations/databases/convex.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ This tutorial assumes that you have already [set up a Clerk application](/docs/q
3939

4040
![The 'Create new template' page of the JWT templates page in the Clerk Dashboard](/docs/images/integrations/convex/create-template.webp)
4141

42-
The Convex template will pre-populate the default audience (`aud`) claim required by Convex. You can include additional claims as necessary. [Shortcodes](/docs/backend-requests/making/jwt-templates#shortcodes) are available to make adding dynamic user values easy.
42+
The Convex template will pre-populate the default audience (`aud`) claim required by Convex. You can include additional claims as necessary. [Shortcodes](/docs/session-requests/making/jwt-templates#shortcodes) are available to make adding dynamic user values easy.
4343

4444
![The 'Create new template' page of the JWT templates page in the Clerk Dashboard. The page is scrolled down to the 'Claims' section](/docs/images/integrations/convex/template-shortcodes.webp)
4545

docs/integrations/databases/fauna.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ This guide will walk you through the steps to integrate Fauna with Clerk in your
8686
1. Select the **New template** button, then select **Fauna** from the list of options.
8787
1. Configure your template:
8888
- The value of the **Name** field will be required when using the template in your code. For this tutorial, name it `fauna`.
89-
- You can leave all other fields as their default settings or customize them to your needs. See the [JWT template guide](/docs/backend-requests/making/jwt-templates#creating-a-template) to learn more about these settings.
90-
- In the **Claims** section, set the `aud` claim to the **Audience URL** you copied from Fauna in Step 2. The URL format should be `https://db.fauna.com/db/<YOUR_FAUNA_DB_ID>`. You can include additional claims if you’d like, but `aud` is the only required one. [Shortcodes](/docs/backend-requests/making/jwt-templates#shortcodes) are available to make adding dynamic user values easy.
89+
- You can leave all other fields as their default settings or customize them to your needs. See the [JWT template guide](/docs/session-requests/making/jwt-templates#creating-a-template) to learn more about these settings.
90+
- In the **Claims** section, set the `aud` claim to the **Audience URL** you copied from Fauna in Step 2. The URL format should be `https://db.fauna.com/db/<YOUR_FAUNA_DB_ID>`. You can include additional claims if you’d like, but `aud` is the only required one. [Shortcodes](/docs/session-requests/making/jwt-templates#shortcodes) are available to make adding dynamic user values easy.
9191
- Select **Save** from the notification bubble to complete setup.
9292

9393
## Install the Fauna library

docs/integrations/databases/grafbase.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Once the Grafbase template is created, you will be redirected to the template's
1313

1414
![The 'Create new template' page of the JWT templates page in the Clerk Dashboard](/docs/images/integrations/grafbase/create-template.webp)
1515

16-
The Grafbase template will pre-populate the default claims required by Grafbase. You can include additional claims as necessary. [Shortcodes](/docs/backend-requests/making/jwt-templates#shortcodes) are available to make adding dynamic user values easy.
16+
The Grafbase template will pre-populate the default claims required by Grafbase. You can include additional claims as necessary. [Shortcodes](/docs/session-requests/making/jwt-templates#shortcodes) are available to make adding dynamic user values easy.
1717

1818
> [!NOTE]
1919
> If your GraphQL API restricts access based on groups, you’ll need to specify the users groups in the `groups` claim.

docs/integrations/databases/hasura.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Once the Hasura template is created, you will be redirected to the template's pa
1313

1414
![The 'Create new template' page of the JWT templates page in the Clerk Dashboard](/docs/images/integrations/hasura/create-template.webp)
1515

16-
The Hasura template will pre-populate the default claims required by Hasura. You can include additional claims as necessary. [Shortcodes](/docs/backend-requests/making/jwt-templates#shortcodes) are available to make adding dynamic user values easy.
16+
The Hasura template will pre-populate the default claims required by Hasura. You can include additional claims as necessary. [Shortcodes](/docs/session-requests/making/jwt-templates#shortcodes) are available to make adding dynamic user values easy.
1717

1818
![The 'Create new template' page of the JWT templates page in the Clerk Dashboard. The page is scrolled down to the 'Claims' section](/docs/images/integrations/hasura/template-shortcodes.webp)
1919

docs/integrations/databases/instantdb.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ This guide will walk you through the steps to integrate InstantDB with Clerk in
3737
<Steps>
3838
## Configure your Clerk session token
3939

40-
InstantDB uses Clerk's [session token](/docs/backend-requests/resources/session-tokens) to authenticate users. To use InstantDB with Clerk, you need to include the `email` claim in your session token.
40+
InstantDB uses Clerk's [session token](/docs/session-requests/session-tokens) to authenticate users. To use InstantDB with Clerk, you need to include the `email` claim in your session token.
4141

4242
1. In the Clerk Dashboard, navigate to the [**Sessions**](https://dashboard.clerk.com/last-active?path=sessions) page.
4343
1. In the **Customize session token** section, select **Edit**.

0 commit comments

Comments
 (0)