Skip to content

Commit

Permalink
Merge branch 'main' into rob/eco-224-nuxt-quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
wobsoriano authored Dec 4, 2024
2 parents 534e974 + d7e8e5a commit f566940
Show file tree
Hide file tree
Showing 380 changed files with 4,932 additions and 2,482 deletions.
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to Clerk's documentation

Thanks for being willing to contribute to [Clerk's documentation](https://clerk.com/docs)! This document outlines how to effectively contribute to the documentation content located in this repository. Check out the [style guide](./styleguides/styleguide.md) for more information on our guidelines for writing content.
Thanks for being willing to contribute to [Clerk's documentation](https://clerk.com/docs)! This document outlines how to effectively contribute to the documentation content located in this repository. See the [style guide](./styleguides/styleguide.md) for more information on our guidelines for writing content.

## Written in MDX

Expand Down Expand Up @@ -396,8 +396,8 @@ interface CodeBlockProps {

You can use the following shortcodes within a code block to inject information from the user's current Clerk instance:

- `{{pub_key}}` – Publishable key
- `{{secret}}` – Secret key
- `{{pub_key}}` – Publishable Key
- `{{secret}}` – Secret Key
- `{{fapi_url}}` – Frontend API URL

````mdx
Expand All @@ -407,7 +407,7 @@ CLERK_SECRET_KEY={{secret}}
```
````

The video below shows what this example looks like once rendered. Notice the eye icon on the code block that once clicked on, reveals the user's secret key.
The video below shows what this example looks like once rendered. Notice the eye icon on the code block that once clicked on, reveals the user's Secret Key.

https://github.com/clerk/clerk-docs/assets/2615508/c1f3fc23-5581-481c-a89c-10c6a04b8536

Expand Down
23 changes: 23 additions & 0 deletions docs/_partials/authenticate-req.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
```tsx
import { createClerkClient } from '@clerk/backend'

export async function GET(req: Request) {
const clerkClient = createClerkClient({
secretKey: process.env.CLERK_SECRET_KEY,
publishableKey: process.env.CLERK_PUBLISHABLE_KEY,
})

const { isSignedIn } = await clerkClient.authenticateRequest(req, {
jwtKey: process.env.CLERK_JWT_KEY,
authorizedParties: ['https://example.com'],
})

if (!isSignedIn) {
return Response.json({ status: 401 })
}

// Add logic to perform protected actions

return Response.json({ message: 'This is a reply' })
}
```
20 changes: 20 additions & 0 deletions docs/_partials/reverification-route-handler.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The following example uses the [`has()`](/docs/references/nextjs/auth-object#has) helper to check if the user has verified their credentials within a specific time period. The `strict` configuration sets the time period to 10 minutes. If the user hasn't verified their credentials within 10 minutes, the `reverificationErrorResponse` utility is used to return an error.

```tsx {{ filename: 'app/api/reverification-example/route.ts' }}
import { auth, reverificationErrorResponse } from '@clerk/nextjs/server'

export const POST = async (req: Request) => {
const { has } = await auth()

// Check if the user has *not* verified their credentials within the past 10 minutes.
const shouldUserRevalidate = !has({ reverification: 'strict' })

// If the user hasn't reverified, return an error with the matching configuration (e.g., `strict`)
if (shouldUserRevalidate) {
return reverificationErrorResponse('strict')
}

// If the user has verified credentials, return a successful response
return new Response({ success: true })
}
```
4 changes: 4 additions & 0 deletions docs/_partials/token-size-callout.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
> [!CAUTION]
> 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.
> It's recommended to move particularly large claims out of the JWT and fetch these using a separate API call from your backend.
> [Learn more](/docs/backend-requests/resources/session-tokens#size-limitations).
2 changes: 1 addition & 1 deletion docs/advanced-usage/clerk-idp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Clerk can be configured as an identity provider to facilitate Single Sign-On (SS

## When should you use Clerk as an OAuth provider?

You can use Clerk as an OAuth provider if you want your users to sign in to a third party site or a tool using their credentials from your application. **This is not the same as supporting an OAuth provider, such as Google, in your application. If you want your users to be able to sign in to your application with an OAuth provider, see [the dedicated guide](/docs/authentication/social-connections/oauth#configuration).**
You can use Clerk as an OAuth provider if you want your users to sign in to a third party site or a tool using their credentials from your application. **This is not the same as supporting an OAuth provider, such as Google, in your application. If you want your users to be able to sign in to your application with an OAuth provider, see the [dedicated guide](/docs/authentication/social-connections/oauth#configuration).**

## How it works

Expand Down
19 changes: 9 additions & 10 deletions docs/advanced-usage/satellite-domains.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ To access authentication state from a satellite domain, users will be transparen

To add a satellite domain:

1. Navigate to the [Clerk Dashboard](https://dashboard.clerk.com/last-active?path=domains)
1. In the navigation sidebar, select **Domains**.
1. Select the **Satellite** tab.
1. In the Clerk Dashboard, navigate to the [**Domains**](https://dashboard.clerk.com/last-active?path=domains) page.
1. Select the **Satellites** tab.
1. Select the **Add satellite domain** button and follow the instructions provided.

For the purposes of this guide:
Expand All @@ -65,11 +64,11 @@ To access authentication state from a satellite domain, users will be transparen
You can configure your satellite application by setting the following environment variables:

> [!NOTE]
> In development, your publishable and secret keys will start with `pk_test_` and `sk_test` respectively.
> In development, your Publishable and Secret Keys will start with `pk_test_` and `sk_test` respectively.
- In the `.env` file associated with your primary domain:

<CodeBlockTabs type="framework" options={["Next.js", "Remix"]}>
<CodeBlockTabs options={["Next.js", "Remix"]}>
```env {{ filename: '.env.local' }}
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY={{pub_key}}
CLERK_SECRET_KEY={{secret}}
Expand All @@ -85,15 +84,15 @@ To access authentication state from a satellite domain, users will be transparen
</CodeBlockTabs>
- In the `.env` file associated with your other (satellite) domain:

<CodeBlockTabs type="framework" options={["Next.js", "Remix"]}>
<CodeBlockTabs options={["Next.js", "Remix"]}>
```env {{ filename: '.env.local' }}
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY={{pub_key}}
CLERK_SECRET_KEY={{secret}}
NEXT_PUBLIC_CLERK_IS_SATELLITE=true
# Production example:
NEXT_PUBLIC_CLERK_DOMAIN=satellite.dev
NEXT_PUBLIC_CLERK_SIGN_IN_URL=https://primary.dev/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=https://primary.dev/sign-up
NEXT_PUBLIC_CLERK_SIGN_UP_URL=https://primary.dev/sign-up
# Development example:
# NEXT_PUBLIC_CLERK_DOMAIN=http://localhost:3001
Expand Down Expand Up @@ -153,15 +152,15 @@ To access authentication state from a satellite domain, users will be transparen
You can configure your satellite application by setting the following properties:

- `isSatellite` - Defines the app as a satellite app when `true`.
- `domain` - Sets the domain of the satellite application. This is required since we cannot figure this out by your publishable key, since it is the same for all of your multi-domain apps.
- `domain` - Sets the domain of the satellite application. This is required since we cannot figure this out by your Publishable Key, since it is the same for all of your multi-domain apps.
- `signInUrl` - This url will be used when signing in on your satellite application and needs to point to your primary application. This option is optional for production instances and required for development instances.
- `signUpUrl` - This url will be used for signing up on your satellite application and needs to point to your primary application. This option is optional for production instances and required for development instances.
- `allowedRedirectOrigins` - This is a list of origins that are allowed to redirect back to from the primary domain.

> [!TIP]
> The `URL` parameter that can be passed to `isSatellite` and `domain` is the request url for server-side usage or the current location for client usage.
<Tabs type="framework" items={["Next.js", "Remix"]}>
<Tabs items={["Next.js", "Remix"]}>
<Tab>
In a Next.js application, you must set the properties in the [`<ClerkProvider>`](/docs/components/clerk-provider) component _and_ in your [`clerkMiddleware()`](/docs/references/nextjs/clerk-middleware#clerk-middleware).

Expand Down Expand Up @@ -407,4 +406,4 @@ To access authentication state from a satellite domain, users will be transparen
You can repeat this process and create as many satellite applications as you need.
</Steps>

If you have any questions about satellite domains, or you're having any trouble setting this up, please contact [[email protected]](mailto:[email protected])
If you have any questions about satellite domains, or you're having any trouble setting this up, contact [[email protected]](mailto:[email protected])
59 changes: 21 additions & 38 deletions docs/advanced-usage/using-proxies.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ When using a proxy, all requests to the Frontend API will be made through your d
To get started, you need to create an application from the [Clerk Dashboard](https://dashboard.clerk.com/). Once you create an instance via the Clerk Dashboard, you will be prompted to choose a domain. For the purposes of this guide, the domain will be `app.dev`.

> [!NOTE]
> For more information on creating a Clerk application, check out our [Set up your application guide](/docs/quickstarts/setup-clerk).
> For more information on creating a Clerk application, see the [setup guide](/docs/quickstarts/setup-clerk).
### Configure your proxy server

Expand All @@ -35,7 +35,7 @@ When using a proxy, all requests to the Frontend API will be made through your d
Three additional headers must be set

- `Clerk-Proxy-Url`: Needs to have the full proxy URL.
- `Clerk-Secret-Key`: The secret key for your Clerk instance.
- `Clerk-Secret-Key`: The Secret Key for your Clerk instance.
- `X-Forwarded-For`: The IP address of the original client making the request.

#### Example configuration
Expand Down Expand Up @@ -146,7 +146,7 @@ When using a proxy, all requests to the Frontend API will be made through your d
</Tabs>

> [!NOTE]
> Every proxy configuration will be different and we're here to help. Please [reach out](/contact/support){{ target: '_blank' }} if there's a specific use-case you're looking to solve.
> Every proxy configuration will be different and we're here to help. [Contact support](/contact/support){{ target: '_blank' }} if there's a specific use-case you're looking to solve.
### Enable proxying

Expand All @@ -158,9 +158,8 @@ When using a proxy, all requests to the Frontend API will be made through your d
<Tabs items={["Dashboard", "Backend API"]}>
<Tab>
1. In the Clerk Dashboard, go to the **[Domains](https://dashboard.clerk.com/last-active?path=domains)** page.
1. Navigate to the **Frontend API** section.
1. Select the **Advanced** drop down.
1. In the Clerk Dashboard, navigate to the **[Domains](https://dashboard.clerk.com/last-active?path=domains)** page.
1. In the **Frontend API** section, select the **Advanced** dropdown.
1. In the **Proxy URL** field, enter your proxy URL. The proxy URL must be a valid URL and resolve correctly.
</Tab>

Expand All @@ -187,7 +186,7 @@ When using a proxy, all requests to the Frontend API will be made through your d

To configure your proxy setup using environment variables, your `.env.local` file should look like this:

<Tabs type="framework" items={["Next.js", "Remix", "JavaScript"]}>
<Tabs items={["Next.js", "Remix", "JavaScript"]}>
<Tab>
```env {{ filename: '.env.local' }}
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY={{pub_key}}
Expand Down Expand Up @@ -220,39 +219,23 @@ When using a proxy, all requests to the Frontend API will be made through your d

#### Properties in your application

<Tabs type="framework" items={["Next.js", "Remix", "JavaScript"]}>
<Tabs items={["Next.js", "Remix", "JavaScript"]}>
<Tab>
To configure your proxy setup using properties in your Next.js application, set the `proxyUrl` property on the [`<ClerkProvider>`](/docs/components/clerk-provider) component.

<CodeBlockTabs type="router" options={["App Router", "Pages Router"]}>
```tsx {{ filename: 'app/layout.tsx', mark: [5] }}
import { ClerkProvider } from '@clerk/nextjs'

export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<ClerkProvider proxyUrl="https://app.dev/__clerk">
<html lang="en">
<body>{children}</body>
</html>
</ClerkProvider>
)
}
```

```tsx {{ filename: '_app.tsx', mark: [6] }}
import { ClerkProvider } from '@clerk/nextjs'
import type { AppProps } from 'next/app'
```tsx {{ filename: 'app/layout.tsx', mark: [5] }}
import { ClerkProvider } from '@clerk/nextjs'

function MyApp({ Component, pageProps }: AppProps) {
return (
<ClerkProvider proxyUrl="https://app.dev/__clerk" {...pageProps}>
<Component {...pageProps} />
</ClerkProvider>
)
}
export default MyApp
```
</CodeBlockTabs>
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<ClerkProvider proxyUrl="https://app.dev/__clerk">
<html lang="en">
<body>{children}</body>
</html>
</ClerkProvider>
)
}
```
</Tab>

<Tab>
Expand Down Expand Up @@ -288,7 +271,7 @@ When using a proxy, all requests to the Frontend API will be made through your d
```js {{ filename: 'main.js' }}
import { Clerk } from '@clerk/clerk-js'

// Initialize Clerk with your Clerk publishable key
// Initialize Clerk with your Clerk Publishable Key
const clerkPubKey = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY

const clerk = new Clerk(clerkPubKey)
Expand All @@ -305,4 +288,4 @@ When using a proxy, all requests to the Frontend API will be made through your d
Your application should now be able to access the Frontend API from your proxy!
</Steps>

If you have any questions about proxying, or you're having any trouble setting this up, please contact [[email protected]](mailto:[email protected]).
If you have any questions about proxying, or you're having any trouble setting this up, contact [[email protected]](mailto:[email protected]).
12 changes: 5 additions & 7 deletions docs/authentication/configuration/email-sms-templates.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ It will be useful to take a look at the following terms as they will reappear in

### Revolvapp WYSIWYG email editor plugin

The email editor uses the [Revolvapp](https://imperavi.com/redactor/legacy/revolvapp) email template editor plugin by Imperavi. To acquaint yourself with the template markup syntax, please consult the corresponding [documentation page](https://imperavi.com/redactor/legacy/revolvapp/docs/syntax/quick-start).
The email editor uses the [Revolvapp](https://imperavi.com/redactor/legacy/revolvapp) email template editor plugin by Imperavi. To acquaint yourself with the template markup syntax, consult [Imperavi's docs](https://imperavi.com/redactor/legacy/revolvapp/docs/syntax/quick-start).

As you will see, the template markup is an HTML-like language and each type of node supports its own set of attributes which control its behavior. A lot of the attributes are borrowed from HTML itself.

Expand All @@ -42,8 +42,7 @@ When editing a template in the Clerk Dashboard, you can insert variables at the

To access the email templates:

1. Navigate to the [Clerk Dashboard](https://dashboard.clerk.com/last-active?path=customization/email).
1. In the navigation sidebar, select **Customization > Emails**.
1. In the Clerk Dashboard, navigate to the [**Emails**](https://dashboard.clerk.com/last-active?path=customization/email) page.
1. Select a template to edit.
1. Once you have selected a template, you will be presented with [template operations](#template-operations), the [template settings](#email-template-settings), and [the WYSIWYG editor](#email-wysiwyg-editor).

Expand All @@ -60,7 +59,7 @@ The following operations are available for an email template:

The following settings can be changed per email template:

- **Delivered by Clerk**: Clerk will deliver your emails using its own Email Service Provider (ESP), which is currently [SendGrid](https://sendgrid.com/). However, if you wish to handle delivery of emails on your own, then you can toggle this setting off. This means that Clerk will no longer be sending this particular email and in order to deliver it yourself, you will need to listen to the `emails.created` [webhook](/docs/integrations/webhooks/overview) and extract the necessary info from the event payload.
- **Delivered by Clerk**: Clerk will deliver your emails using its own Email Service Provider (ESP), which is currently [SendGrid](https://sendgrid.com/). However, if you wish to handle delivery of emails on your own, then you can toggle this setting off. This means that Clerk will no longer be sending this particular email and in order to deliver it yourself, you will need to listen to the `emails.created` [webhook](/docs/webhooks/overview) and extract the necessary info from the event payload.
- **Name**: a name for the template on the template listing page. It does not affect the outgoing email in any way.
- **From**: the email address that will be used as the **From** address in the email header. The format is `<local part>@<your-domain>`. You can change the local part to a custom value. If no value is provided, it defaults `noreply`.
- **Reply-To**: the email address that will be used as the **Reply-To** address in the email header. This is useful if you want to direct replies to a different email address than the one used in the **From** field. The format is `<local part>@<your-domain>`. You can change the local part to a custom value. If no value is provided, the **Reply-To** header will be omitted.
Expand Down Expand Up @@ -104,16 +103,15 @@ The email WYSIWYG editor text area is intended mainly for authoring content. Tho

To access the SMS templates:

1. Navigate to the [Clerk Dashboard](https://dashboard.clerk.com/last-active?path=customization/sms).
1. In the navigation sidebar, select **Customization > SMS**.
1. In the Clerk Dashboard, navigate to the [**SMS**](https://dashboard.clerk.com/last-active?path=customization/sms) page.
1. Select a template to edit. You can also disable certain SMS notifications.
1. A modal will appear that shows you what the template looks like, plus options to toggle the [**Delivered by Clerk**](#delivered-by-clerk) setting or to [request a change to the template](#request-change).

### Delivered by Clerk

Clerk will deliver your SMS messages using its own SMS Gateway. However, if you wish to handle SMS delivery on your own, then you can toggle **Delivered by Clerk** off.

This means that Clerk will no longer be sending this particular SMS and in order to deliver it yourself, you will need to listen to the `sms.created` [webhook](/docs/integrations/webhooks/overview) and extract the necessary info from the event payload.
This means that Clerk will no longer be sending this particular SMS and in order to deliver it yourself, you will need to listen to the `sms.created` [webhook](/docs/webhooks/overview) and extract the necessary info from the event payload.

> [!NOTE]
> Remember, this is a per-template setting and will not be applied to other templates.
Expand Down
Loading

0 comments on commit f566940

Please sign in to comment.