diff --git a/docs/authentication/configuration/legal-compliance.mdx b/docs/authentication/configuration/legal-compliance.mdx index 78d544f5b0..61176d02a9 100644 --- a/docs/authentication/configuration/legal-compliance.mdx +++ b/docs/authentication/configuration/legal-compliance.mdx @@ -3,7 +3,7 @@ title: Legal compliance description: Learn how to configure your legal compliance settings in the Clerk Dashboard. --- -Clerk provides a legal compliance setting that allows you to require users to agree to your terms of service or privacy policy before they can sign up to your application. After enabling the setting, there will be a checkbox to accept the terms in your [`` component](/docs/components/authentication/sign-up) or [Account Portal sign-up page](/docs/customization/account-portal/overview#sign-up). +Clerk provides a legal compliance setting that allows you to require users to agree to your terms of service or privacy policy before they can sign up to your application. After enabling the setting, there will be a checkbox to accept the terms in your [`` component](/docs/components/authentication/sign-up) or [Account Portal sign-up page](/docs/customization/account-portal/overview#sign-in-or-up). To configure the setting: diff --git a/docs/components/authentication/sign-in.mdx b/docs/components/authentication/sign-in.mdx index c4ffa564fe..a2a1134721 100644 --- a/docs/components/authentication/sign-in.mdx +++ b/docs/components/authentication/sign-in.mdx @@ -5,7 +5,7 @@ description: Clerk's component renders a UI for signing in users. ![The \ component renders a UI for signing in users.](/docs/images/ui-components/sign-in.png){{ style: { maxWidth: '460px' } }} -The `` component renders a UI for signing in users. The functionality of the `` component is controlled by the instance settings you specify in the [Clerk Dashboard](https://dashboard.clerk.com), such as [sign-in and sign-up options](/docs/authentication/configuration/sign-up-sign-in-options) and [social connections](/docs/authentication/social-connections/overview). You can further customize your `` component by passing additional [properties](#properties) at the time of rendering. +The `` component renders a UI to allow users to sign in or sign up by default. The functionality of the `` component is controlled by the instance settings you specify in the [Clerk Dashboard](https://dashboard.clerk.com), such as [sign-in and sign-up options](/docs/authentication/configuration/sign-up-sign-in-options) and [social connections](/docs/authentication/social-connections/overview). You can further customize your `` component by passing additional [properties](#properties) at the time of rendering. > [!NOTE] > The `` and `` components cannot render when a user is already signed in, unless the application allows multiple sessions. If a user is already signed in and the application only allows a single session, Clerk will redirect the user to the Home URL instead. @@ -92,6 +92,13 @@ All props are optional. --- + - `withSignUp?` + - `boolean` + + Opt into sign-in-or-up flow by setting this prop to `true`. Defaults to `false`. When true, if a user does not exist, they will be prompted to sign up. If a user exists, they will be prompted to sign in. + + --- + - `fallback?` - `ReactNode` @@ -106,7 +113,7 @@ The following example includes basic implementation of the `` componen The following example demonstrates how you can use the `` component on a public page. - If you would like to create a dedicated `/sign-in` page in your Next.js application, see the [dedicated guide](/docs/references/nextjs/custom-signup-signin-pages). + If you would like to create a dedicated `/sign-in` page in your Next.js application, see the [dedicated guide](/docs/references/nextjs/custom-sign-in-or-up-page). ```tsx {{ filename: 'app/page.tsx' }} import { SignIn, useUser } from '@clerk/nextjs' diff --git a/docs/components/authentication/sign-up.mdx b/docs/components/authentication/sign-up.mdx index 7540ace8e4..4334d2fa53 100644 --- a/docs/components/authentication/sign-up.mdx +++ b/docs/components/authentication/sign-up.mdx @@ -99,7 +99,7 @@ The following example includes basic implementation of the `` componen The following example demonstrates how you can use the `` component on a public page. - If you would like to create a dedicated `/sign-up` page in your Next.js application, see the [dedicated guide](/docs/references/nextjs/custom-signup-signin-pages). + If you would like to create a dedicated `/sign-up` page in your Next.js application, see the [dedicated guide](/docs/references/nextjs/custom-sign-up-page). ```tsx {{ filename: 'app/page.tsx' }} import { SignUp, useUser } from '@clerk/nextjs' diff --git a/docs/custom-flows/embedded-email-links.mdx b/docs/custom-flows/embedded-email-links.mdx index 2af4535257..3950c4d300 100644 --- a/docs/custom-flows/embedded-email-links.mdx +++ b/docs/custom-flows/embedded-email-links.mdx @@ -32,7 +32,7 @@ This guide will demonstrate how to generate a sign-in token and use it to sign i -d '{ "user_id": "user_123" }' ``` - This will return a `url` property, which can be used as your email link. Keep in mind that this link will use the [Account Portal sign-in page](/docs/customization/account-portal/overview#sign-in) to sign in the user. + This will return a `url` property, which can be used as your email link. Keep in mind that this link will use the [Account Portal sign-in page](/docs/customization/account-portal/overview#sign-in-or-up) to sign in the user. If you would rather use your own sign-in page, you can use the `token` property that is returned. Add the `token` as a query param in any link, such as the following example: diff --git a/docs/custom-flows/invitations.mdx b/docs/custom-flows/invitations.mdx index 12d73336ea..fe173b5e8f 100644 --- a/docs/custom-flows/invitations.mdx +++ b/docs/custom-flows/invitations.mdx @@ -5,7 +5,7 @@ description: Learn how to use the Clerk API to build a custom flow for handling -When a user visits an [invitation](/docs/users/invitations) link, and no custom redirect URL was specified, then they will be redirected to the [Account Portal sign-up page](/docs/customization/account-portal/overview#sign-up) and **their email address will be automatically verified.** +When a user visits an [invitation](/docs/users/invitations) link, and no custom redirect URL was specified, then they will be redirected to the [Account Portal sign-up page](/docs/customization/account-portal/overview#sign-in-or-up) and **their email address will be automatically verified.** However, if you specified [a redirect URL when creating the invitation](/docs/users/invitations#redirect-url), you must handle the sign-up flow in your code for that page. You can either embed the [``](/docs/components/authentication/sign-up) component on that page, or if the prebuilt component doesn't meet your specific needs or if you require more control over the logic, you can rebuild the existing Clerk flows using the Clerk API. diff --git a/docs/integrations/databases/firebase.mdx b/docs/integrations/databases/firebase.mdx index 61219e5315..4e2ac089a7 100644 --- a/docs/integrations/databases/firebase.mdx +++ b/docs/integrations/databases/firebase.mdx @@ -205,7 +205,7 @@ Integrating Firebase with Clerk gives you the benefits of using Firebase's featu --- - - [Create custom sign-up and sign-in pages in your Next.js app](/docs/references/nextjs/custom-signup-signin-pages) + - [Create a custom sign-in-or-up page in your Next.js app](/docs/references/nextjs/custom-sign-in-or-up-page) - Learn how add custom sign-up and sign-in pages with Clerk components in your Next.js application. --- diff --git a/docs/manifest.json b/docs/manifest.json index f9b33e6bad..f4e8c7a420 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1790,8 +1790,12 @@ "href": "/docs/references/nextjs/read-session-data" }, { - "title": "Add custom sign-up and sign-in pages", - "href": "/docs/references/nextjs/custom-signup-signin-pages" + "title": "Add a custom sign-in-or-up page", + "href": "/docs/references/nextjs/custom-sign-in-or-up-page" + }, + { + "title": "Add a custom sign-up page", + "href": "/docs/references/nextjs/custom-sign-up-page" }, { "title": "Add custom onboarding", @@ -2355,8 +2359,12 @@ "href": "/docs/references/expo/web-support/overview" }, { - "title": "Add custom sign-up and sign-in pages", - "href": "/docs/references/expo/web-support/custom-signup-signin-pages" + "title": "Add a custom sign-in-or-up page", + "href": "/docs/references/expo/web-support/custom-sign-in-or-up-page" + }, + { + "title": "Add a custom sign-up page", + "href": "/docs/references/expo/web-support/custom-sign-up-page" } ] ] @@ -2447,8 +2455,12 @@ "href": "/docs/references/react-router/read-session-data" }, { - "title": "Add custom sign up and sign in pages", - "href": "/docs/references/react-router/custom-signup-signin-pages" + "title": "Add custom sign-in-or-up page", + "href": "/docs/references/react-router/custom-sign-in-or-up-page" + }, + { + "title": "Add custom sign-up page", + "href": "/docs/references/react-router/custom-sign-up-page" }, { "title": "Library mode", @@ -2493,9 +2505,14 @@ "href": "/docs/references/remix/spa-mode" }, { - "title": "Add custom sign up and sign in pages", + "title": "Add custom sign-in-or-up page", "wrap": true, - "href": "/docs/references/remix/custom-signup-signin-pages" + "href": "/docs/references/remix/custom-sign-in-or-up-page" + }, + { + "title": "Add custom sign-up page", + "wrap": true, + "href": "/docs/references/remix/custom-sign-up-page" }, { "title": "Read session and user data", @@ -2536,8 +2553,13 @@ "items": [ [ { - "title": "Add custom sign up and sign in pages", - "href": "/docs/references/tanstack-start/custom-signup-signin-pages", + "title": "Add custom sign-in-or-up-page", + "href": "/docs/references/tanstack-start/custom-sign-in-or-up-page", + "wrap": true + }, + { + "title": "Add custom sign-up-page", + "href": "/docs/references/tanstack-start/custom-sign-up-page", "wrap": true }, { diff --git a/docs/organizations/accept-organization-invitations.mdx b/docs/organizations/accept-organization-invitations.mdx index 9d449c7eb3..4bbaf5f407 100644 --- a/docs/organizations/accept-organization-invitations.mdx +++ b/docs/organizations/accept-organization-invitations.mdx @@ -5,7 +5,7 @@ description: Learn how to use the Clerk API to build a custom flows for handling -When a user visits an [organization invitation](/docs/organizations/invitations) link, and no custom redirect URL was specified, and they have an account for your application, then they will be redirected to the [Account Portal sign-in page](/docs/customization/account-portal/overview#sign-in). If they do not have an account for your application, they will be redirected to the [Account Portal sign-up page](/docs/customization/account-portal/overview#sign-up). +When a user visits an [organization invitation](/docs/organizations/invitations) link, and no custom redirect URL was specified, and they have an account for your application, then they will be redirected to the [Account Portal sign-in page](/docs/customization/account-portal/overview#sign-in-or-up). If they do not have an account for your application, they will be redirected to the [Account Portal sign-up page](/docs/customization/account-portal/overview#sign-in-or-up). However, if you specified [a redirect URL when creating the invitation](/docs/users/invitations#redirect-url), you must handle the sign-up and sign-in flows in your code for that page. You can either embed the [`](/docs/components/authentication/sign-in) component on that page, or if the prebuilt component doesn't meet your specific needs or if you require more control over the logic, you can rebuild the existing Clerk flows using the Clerk API. diff --git a/docs/organizations/invitations.mdx b/docs/organizations/invitations.mdx index bac4c3d7ae..f86a47a037 100644 --- a/docs/organizations/invitations.mdx +++ b/docs/organizations/invitations.mdx @@ -5,7 +5,7 @@ description: Learn how to invite users to your organization. Organization invitations allow you to add new members to your organization, granting them access to organization-specific features and resources. -Once you create an invitation, Clerk sends an email to the invited user with a unique invitation link. When the user visits the organization invitation link, they will be redirected to the [Account Portal sign-in page](/docs/customization/account-portal/overview#sign-in). If the user is already signed in, they will be redirected to your application's homepage (`/`). If you want to redirect the user to a specific page in your application, you can [specify a redirect URL when creating the invitation](#redirect-url). +Once you create an invitation, Clerk sends an email to the invited user with a unique invitation link. When the user visits the organization invitation link, they will be redirected to the [Account Portal sign-in page](/docs/customization/account-portal/overview#sign-in-or-up). If the user is already signed in, they will be redirected to your application's homepage (`/`). If you want to redirect the user to a specific page in your application, you can [specify a redirect URL when creating the invitation](#redirect-url). ## Create an invitation diff --git a/docs/quickstarts/astro.mdx b/docs/quickstarts/astro.mdx index c6ed6adbaf..aa45f03b6f 100644 --- a/docs/quickstarts/astro.mdx +++ b/docs/quickstarts/astro.mdx @@ -112,7 +112,7 @@ description: Add authentication and user management to your Astro app with Clerk - [``](/docs/components/control/signed-in): Children of this component can only be seen while **signed in**. - [``](/docs/components/control/signed-out): Children of this component can only be seen while **signed out**. - [``](/docs/components/user/user-button): Shows the signed-in user's avatar. Selecting it opens a dropdown menu with account management options. - - [``](/docs/components/unstyled/sign-in-button): An unstyled component that links to the sign-in page. In this example, since no props or [environment variables](/docs/deployments/clerk-environment-variables) are set for the sign-in URL, this component links to the [Account Portal sign-in page](/docs/customization/account-portal/overview#sign-in). + - [``](/docs/components/unstyled/sign-in-button): An unstyled component that links to the sign-in page. In this example, since no props or [environment variables](/docs/deployments/clerk-environment-variables) are set for the sign-in URL, this component links to the [Account Portal sign-in page](/docs/customization/account-portal/overview#sign-in-or-up). ```astro {{ filename: 'src/layouts/SiteLayout.astro' }} --- diff --git a/docs/quickstarts/nextjs.mdx b/docs/quickstarts/nextjs.mdx index 1c6e51bce7..f5be6bbc35 100644 --- a/docs/quickstarts/nextjs.mdx +++ b/docs/quickstarts/nextjs.mdx @@ -104,7 +104,7 @@ description: Add authentication and user management to your Next.js app with Cle - [``](/docs/components/control/signed-in): Children of this component can only be seen while **signed in**. - [``](/docs/components/control/signed-out): Children of this component can only be seen while **signed out**. - [``](/docs/components/user/user-button): Shows the signed-in user's avatar. Selecting it opens a dropdown menu with account management options. - - [``](/docs/components/unstyled/sign-in-button): An unstyled component that links to the sign-in page. In this example, since no props or [environment variables](/docs/deployments/clerk-environment-variables) are set for the sign-in URL, this component links to the [Account Portal sign-in page](/docs/customization/account-portal/overview#sign-in). + - [``](/docs/components/unstyled/sign-in-button): An unstyled component that links to the sign-in page. In this example, since no props or [environment variables](/docs/deployments/clerk-environment-variables) are set for the sign-in URL, this component links to the [Account Portal sign-in page](/docs/customization/account-portal/overview#sign-in-or-up). Select your preferred router to learn how to make this data available across your entire app: @@ -186,8 +186,8 @@ description: Add authentication and user management to your Next.js app with Cle --- - - [Create custom sign-up and sign-in pages](/docs/references/nextjs/custom-signup-signin-pages) - - Learn how add custom sign-up and sign-in pages with Clerk components. + - [Create a custom sign-in or sign-up page](/docs/references/nextjs/custom-sign-in-or-up-page) + - Learn how add a custom sign-in or sign-up page with Clerk components. --- diff --git a/docs/quickstarts/react-router.mdx b/docs/quickstarts/react-router.mdx index bd97ce191b..d8927d7f0f 100644 --- a/docs/quickstarts/react-router.mdx +++ b/docs/quickstarts/react-router.mdx @@ -227,8 +227,8 @@ This guide assumes that you're using [React Router v7 or later](https://api.reac ## Next steps - - [Add custom sign-up and sign-in pages](/docs/references/react-router/custom-signup-signin-pages) - - Learn how to add custom sign-up and sign-in pages to your React Router app with Clerk's prebuilt components. + - [Create a custom sign-in-or-up page](/docs/references/react-router/custom-sign-in-or-up-page) + - Learn how add custom sign-in-or-up page with Clerk components. --- diff --git a/docs/quickstarts/remix.mdx b/docs/quickstarts/remix.mdx index 7b7909a905..34a03ffbc0 100644 --- a/docs/quickstarts/remix.mdx +++ b/docs/quickstarts/remix.mdx @@ -197,7 +197,7 @@ Learn how to use Clerk to quickly and easily add secure authentication and user - [``](/docs/components/control/signed-in): Children of this component can only be seen while **signed in**. - [``](/docs/components/control/signed-out): Children of this component can only be seen while **signed out**. - [``](/docs/components/user/user-button): Shows the signed-in user's avatar. Selecting it opens a dropdown menu with account management options. - - [``](/docs/components/unstyled/sign-in-button): An unstyled component that links to the sign-in page. In this example, since no props or [environment variables](/docs/deployments/clerk-environment-variables) are set for the sign-in URL, this component links to the [Account Portal sign-in page](/docs/customization/account-portal/overview#sign-in) + - [``](/docs/components/unstyled/sign-in-button): An unstyled component that links to the sign-in page. In this example, since no props or [environment variables](/docs/deployments/clerk-environment-variables) are set for the sign-in URL, this component links to the [Account Portal sign-in page](/docs/customization/account-portal/overview#sign-in-or-up) ```tsx {{ filename: 'routes/_index.tsx' }} import { @@ -280,8 +280,8 @@ Learn how to use Clerk to quickly and easily add secure authentication and user ## Next steps - - [Create custom sign-up and sign-in pages](/docs/references/remix/custom-signup-signin-pages) - - Learn how add custom sign-up and sign-in pages with Clerk components. + - [Create a custom sign-in-or-up page](/docs/references/remix/custom-sign-in-or-up-page) + - Learn how add custom sign-in-or-up page with Clerk components. --- diff --git a/docs/quickstarts/tanstack-start.mdx b/docs/quickstarts/tanstack-start.mdx index 4086fe8555..c45651f59d 100644 --- a/docs/quickstarts/tanstack-start.mdx +++ b/docs/quickstarts/tanstack-start.mdx @@ -143,7 +143,7 @@ description: Learn how to use Clerk to quickly and easily add secure authenticat - [``](/docs/components/control/signed-in): Children of this component can only be seen while **signed in**. - [``](/docs/components/control/signed-out): Children of this component can only be seen while **signed out**. - [``](/docs/components/user/user-button): Shows the signed-in user's avatar. Selecting it opens a dropdown menu with account management options. - - [``](/docs/components/unstyled/sign-in-button): An unstyled component that links to the sign-in page. In this example, since no props or [environment variables](/docs/deployments/clerk-environment-variables) are set for the sign-in URL, this component links to the [Account Portal sign-in page](/docs/customization/account-portal/overview#sign-in). + - [``](/docs/components/unstyled/sign-in-button): An unstyled component that links to the sign-in page. In this example, since no props or [environment variables](/docs/deployments/clerk-environment-variables) are set for the sign-in URL, this component links to the [Account Portal sign-in page](/docs/customization/account-portal/overview#sign-in-or-up). ```tsx {{ filename: 'app/routes/index.tsx' }} import { @@ -243,8 +243,8 @@ description: Learn how to use Clerk to quickly and easily add secure authenticat ## Next steps - - [Create custom sign-up and sign-in pages](/docs/references/tanstack-start/custom-signup-signin-pages) - - Learn how add custom sign-up and sign-in pages with Clerk components. + - [Create a custom sign-in-or-up page](/docs/references/tanstack-start/custom-sign-in-or-up-page) + - Learn how add custom sign-in-or-up page with Clerk components. --- diff --git a/docs/references/expo/web-support/custom-signup-signin-pages.mdx b/docs/references/expo/web-support/custom-sign-in-or-up-page.mdx similarity index 63% rename from docs/references/expo/web-support/custom-signup-signin-pages.mdx rename to docs/references/expo/web-support/custom-sign-in-or-up-page.mdx index e0d47a0dd1..6a85e78499 100644 --- a/docs/references/expo/web-support/custom-signup-signin-pages.mdx +++ b/docs/references/expo/web-support/custom-sign-in-or-up-page.mdx @@ -1,28 +1,16 @@ --- -title: Build sign in and sign up pages with prebuilt components on web -description: Learn how to add custom sign-in and sign-up pages to your Expo app with Clerk's prebuilt components. +title: Build your own sign-in-or-up page with prebuilt components on web +description: Learn how to add custom sign-in-or-up page to your Expo app with Clerk's prebuilt components. --- -This guide shows you how to use the [``](/docs/components/authentication/sign-in) and [``](/docs/components/authentication/sign-up) prebuilt components in order to build custom sign-in and sign-up pages for your Expo **web** app. +This guide shows you how to use the [``](/docs/components/authentication/sign-in) prebuilt component in order to build custom sign-in-or-up page for your Expo **web** app. -This guide uses [Expo Router](https://docs.expo.dev/router/introduction/) and the [platform-specific extensions](https://docs.expo.dev/router/create-pages/#platform-specific-extensions) to build the sign-up and sign-in pages specifically for the **web** platform. +This guide uses [Expo Router](https://docs.expo.dev/router/introduction/) and the [platform-specific extensions](https://docs.expo.dev/router/create-pages/#platform-specific-extensions) to build the sign-in-or-up page specifically for the **web** platform. - ## Build a sign-up page + ## Build a sign-in-or-up page - The following example demonstrates how to render the [``](/docs/components/authentication/sign-up) component. - - ```tsx filename="/app/sign-up.web.tsx" - import { SignUp } from '@clerk/clerk-expo/web' - - export default function Page() { - return - } - ``` - - ## Build a sign-in page - - The following example demonstrates how to render the [``](/docs/components/authentication/sign-in) component. + The following example demonstrates how to render the [``](/docs/components/authentication/sign-in) component to allow users to both sign-in or sign-up from a single flow. ```tsx filename="/app/sign-in.web.tsx" import { SignIn } from '@clerk/clerk-expo/web' @@ -32,7 +20,7 @@ This guide uses [Expo Router](https://docs.expo.dev/router/introduction/) and th } ``` - ## Visit your new pages + ## Visit your new page To run your project, use the following command: @@ -50,7 +38,7 @@ This guide uses [Expo Router](https://docs.expo.dev/router/introduction/) and th ``` - Visit your new custom pages locally at [localhost:8081/sign-in](http://localhost:8081/sign-in) and [localhost:8081/sign-up](http://localhost:8081/sign-up). + Visit your new custom pages locally at [localhost:8081/sign-in](http://localhost:8081/sign-in). ## More resources @@ -58,6 +46,11 @@ This guide uses [Expo Router](https://docs.expo.dev/router/introduction/) and th Use the following guides to learn more about Clerk components, how to build custom flows for your native apps, and how to use Clerk's client-side helpers. + - [Custom sign-up page](/docs/references/expo/web-support/custom-sign-up-page) + - Learn how to add a custom sign-up page to your Next.js app with Clerk's prebuilt components. + + --- + - [Prebuilt components](/docs/components/overview) - Learn more about Clerk's suite of components that let you quickly add authentication to your app. diff --git a/docs/references/expo/web-support/custom-sign-up-page.mdx b/docs/references/expo/web-support/custom-sign-up-page.mdx new file mode 100644 index 0000000000..2b5e0c4bf8 --- /dev/null +++ b/docs/references/expo/web-support/custom-sign-up-page.mdx @@ -0,0 +1,66 @@ +--- +title: Build your own sign-up page with prebuilt components on web +description: Learn how to add custom sign-up page to your Expo app with Clerk's prebuilt components. +--- + +This guide shows you how to use the [``](/docs/components/authentication/sign-up) prebuilt component in order to build custom sign-up page for your Expo **web** app. + +This guide uses [Expo Router](https://docs.expo.dev/router/introduction/) and the [platform-specific extensions](https://docs.expo.dev/router/create-pages/#platform-specific-extensions) to build the sign-in-or-up page specifically for the **web** platform. + + + ## Build a sign-up page + + The following example demonstrates how to render the [``](/docs/components/authentication/sign-up) component. + + ```tsx filename="/app/sign-up.web.tsx" + import { SignUp } from '@clerk/clerk-expo/web' + + export default function Page() { + return + } + ``` + + ## Visit your new page + + To run your project, use the following command: + + + ```bash filename="terminal" + npm run web + ``` + + ```bash filename="terminal" + yarn web + ``` + + ```bash filename="terminal" + pnpm web + ``` + + + Visit your new custom pages locally at [localhost:8081/sign-up](http://localhost:8081/sign-up). + + +## More resources + +Use the following guides to learn more about Clerk components, how to build custom flows for your native apps, and how to use Clerk's client-side helpers. + + + - [Prebuilt components](/docs/components/overview) + - Learn more about Clerk's suite of components that let you quickly add authentication to your app. + + --- + + - [Customization & localization](/docs/customization/overview) + - Learn how to customize and localize Clerk components. + + --- + + - [Custom flows](/docs/custom-flows/overview) + - Expo native apps require custom flows in place of prebuilt components. Learn more about custom flows. + + --- + + - [Client-side helpers](/docs/references/react/use-user) + - Learn more about our client-side helpers and how to use them. + diff --git a/docs/references/nextjs/authjs-migration.mdx b/docs/references/nextjs/authjs-migration.mdx index a038b20029..cac207c547 100644 --- a/docs/references/nextjs/authjs-migration.mdx +++ b/docs/references/nextjs/authjs-migration.mdx @@ -114,7 +114,7 @@ This guide shows how to migrate an application using Auth.js (formerly NextAuth. If Clerk's Account Portal pages aren't a good fit your app, you can build a custom sign-in and sign-up UI in one of two ways: - - use the [prebuilt components](/docs/references/nextjs/custom-signup-signin-pages), such as the [``](/docs/components/authentication/sign-in) and [``](/docs/components/authentication/sign-up) components + - use the [prebuilt components](/docs/references/nextjs/custom-sign-in-or-up-page), such as the [``](/docs/components/authentication/sign-in) and [``](/docs/components/authentication/sign-up) components - build a [fully custom UI using the Clerk API](/docs/custom-flows/overview), leveraging Clerk's React hooks such as [`useSignIn()`](/docs/references/react/use-sign-in) and [`useSignUp()`](/docs/references/react/use-sign-up) ## Protect your app diff --git a/docs/references/nextjs/custom-signup-signin-pages.mdx b/docs/references/nextjs/custom-sign-in-or-up-page.mdx similarity index 63% rename from docs/references/nextjs/custom-signup-signin-pages.mdx rename to docs/references/nextjs/custom-sign-in-or-up-page.mdx index 6b971df480..23f5a4159d 100644 --- a/docs/references/nextjs/custom-signup-signin-pages.mdx +++ b/docs/references/nextjs/custom-sign-in-or-up-page.mdx @@ -1,34 +1,19 @@ --- -title: Build your own sign-in and sign-up pages for your Next.js app with Clerk -description: Learn how to add custom sign-in and sign-up pages to your Next.js app with Clerk's prebuilt components. +title: Build your own sign-in-or-up page for your Next.js app with Clerk +description: Learn how to add a custom sign-in-or-up page to your Next.js app with Clerk's prebuilt components. --- -This guide shows you how to use the [``](/docs/components/authentication/sign-in) and [``](/docs/components/authentication/sign-up) components with the [Next.js optional catch-all route](https://nextjs.org/docs/pages/building-your-application/routing/dynamic-routes#catch-all-segments) in order to build custom sign-in and sign-up pages for your Next.js app. +This guide shows you how to use the [``](/docs/components/authentication/sign-in) component with the [Next.js optional catch-all route](https://nextjs.org/docs/pages/building-your-application/routing/dynamic-routes#catch-all-segments) in order to build a custom page for your Next.js app that allows users to sign in or sign up within a single flow. If the prebuilt components don't meet your specific needs or if you require more control over the logic, you can rebuild the existing Clerk flows using the Clerk API. For more information, see the [custom flow guides](/docs/custom-flows/overview). -> [!NOTE] -> Watch the video version of this guide on the Clerk YouTube channel → [YouTube (4 minutes)](https://youtu.be/fsuHLafTYyg). - > [!NOTE] > Just getting started with Clerk and Next.js? See the [quickstart tutorial](/docs/quickstarts/nextjs)! - ## Build a sign-up page - - The following example demonstrates how to render the [``](/docs/components/authentication/sign-up) component. - - ```tsx {{ filename: 'app/sign-up/[[...sign-up]]/page.tsx' }} - import { SignUp } from '@clerk/nextjs' - - export default function Page() { - return - } - ``` - - ## Build a sign-in page + ## Build a sign-in-or-up page - The following example demonstrates how to render the [``](/docs/components/authentication/sign-in) component. + The following example demonstrates how to render the [``](/docs/components/authentication/sign-up) component to allow users to both sign-in or sign-up from a single flow. ```tsx {{ filename: 'app/sign-in/[[...sign-in]]/page.tsx' }} import { SignIn } from '@clerk/nextjs' @@ -38,20 +23,20 @@ If the prebuilt components don't meet your specific needs or if you require more } ``` - ## Make the sign-up and sign-in routes public + ## Make the sign-in-or-up route public By default, `clerkMiddleware()` makes all routes public. **This step is specifically for applications that have configured `clerkMiddleware()` to make [all routes protected](/docs/references/nextjs/clerk-middleware#protect-all-routes).** If you have not configured `clerkMiddleware()` to protect all routes, you can skip this step. - To make the sign-up and sign-in routes public: + To make the sign-in route public: - Navigate to your `middleware.ts` file. - - Create a new [route matcher](/docs/references/nextjs/clerk-middleware#create-route-matcher) that matches the sign-up and sign-in routes, or you can add them to an existing route matcher that is making routes public. + - Create a new [route matcher](/docs/references/nextjs/clerk-middleware#create-route-matcher) that matches the sign-in route, or you can add it to your existing route matcher that is making routes public. - Create a check to see if the user's current route is a public route. If it is not a public route, use [`auth.protect()`](/docs/references/nextjs/auth#protect) to protect the route. ```tsx {{ filename: 'middleware.ts' }} import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server' - const isPublicRoute = createRouteMatcher(['/sign-in(.*)', '/sign-up(.*)']) + const isPublicRoute = createRouteMatcher(['/sign-in(.*)']) export default clerkMiddleware(async (auth, request) => { if (!isPublicRoute(request)) { @@ -71,14 +56,13 @@ If the prebuilt components don't meet your specific needs or if you require more ## Update your environment variables - Update your environment variables to point to your custom sign-in and sign-up pages. Learn more about the available [environment variables](/docs/deployments/clerk-environment-variables). + Update your environment variables to point to your custom sign-in page. Learn more about the available [environment variables](/docs/deployments/clerk-environment-variables). ```env {{ filename: '.env.local' }} NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in - NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up ``` - ## Visit your new pages + ## Visit your new page Run your project with the following command: @@ -96,12 +80,17 @@ If the prebuilt components don't meet your specific needs or if you require more ``` - Visit your new custom pages locally at [localhost:3000/sign-in](http://localhost:3000/sign-in) and [localhost:3000/sign-up](http://localhost:3000/sign-up). + Visit your new custom page locally at [localhost:3000/sign-in](http://localhost:3000/sign-in). ## Next steps + - [Custom sign-up page](/docs/references/nextjs/custom-sign-up-page) + - Learn how to add a custom sign-up page to your Next.js app with Clerk's prebuilt components. + + --- + - [Read user and session data](/docs/references/nextjs/read-session-data) - Learn how to use Clerk's hooks and helpers to access the active session and user data in your Next.js application. diff --git a/docs/references/nextjs/custom-sign-up-page.mdx b/docs/references/nextjs/custom-sign-up-page.mdx new file mode 100644 index 0000000000..fb34f2f961 --- /dev/null +++ b/docs/references/nextjs/custom-sign-up-page.mdx @@ -0,0 +1,110 @@ +--- +title: Build your own sign-up page for your Next.js app with Clerk +description: Learn how to add a custom sign-up page to your Next.js app with Clerk's prebuilt components. +--- + +By default, the [``](/docs/references/nextjs/custom-sign-in-or-up-page) component handles signing-in or signing-up, but if you'd like to have a dedicated sign-up page, this guide shows you how to use the [``](/docs/components/authentication/sign-up) component with the [Next.js optional catch-all route](https://nextjs.org/docs/pages/building-your-application/routing/dynamic-routes#catch-all-segments) in order to build custom sign-up page for your Next.js app. + +If the prebuilt components don't meet your specific needs or if you require more control over the logic, you can rebuild the existing Clerk flows using the Clerk API. For more information, see the [custom flow guides](/docs/custom-flows/overview). + +> [!NOTE] +> Just getting started with Clerk and Next.js? See the [quickstart tutorial](/docs/quickstarts/nextjs)! + + + ## Build a sign-up page + + The following example demonstrates how to render the [``](/docs/components/authentication/sign-up) component. + + ```tsx {{ filename: 'app/sign-up/[[...sign-up]]/page.tsx' }} + import { SignUp } from '@clerk/nextjs' + + export default function Page() { + return + } + ``` + + ## Make the sign-up route public + + By default, `clerkMiddleware()` makes all routes public. **This step is specifically for applications that have configured `clerkMiddleware()` to make [all routes protected](/docs/references/nextjs/clerk-middleware#protect-all-routes).** If you have not configured `clerkMiddleware()` to protect all routes, you can skip this step. + + To make the sign-up route public: + + - Navigate to your `middleware.ts` file. + - Add the sign-up route to your existing route matcher that is making routes public. + + ```tsx {{ filename: 'middleware.ts', ins: [5] }} + import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server' + + // prettier-ignore + const isPublicRoute = createRouteMatcher([ + '/sign-in(.*)', + '/sign-up(.*)' + ]) + + export default clerkMiddleware(async (auth, request) => { + if (!isPublicRoute(request)) { + await auth.protect() + } + }) + + export const config = { + matcher: [ + // Skip Next.js internals and all static files, unless found in search params + '/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)', + // Always run for API routes + '/(api|trpc)(.*)', + ], + } + ``` + + ## Update your environment variables + + Update your environment variables to point to your custom sign-in and sign-up pages. Learn more about the available [environment variables](/docs/deployments/clerk-environment-variables). + + ```env {{ filename: '.env.local', ins: [2] }} + NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in + NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up + ``` + + ## Visit your new page + + Run your project with the following command: + + + ```bash {{ filename: 'terminal' }} + npm run dev + ``` + + ```bash {{ filename: 'terminal' }} + yarn dev + ``` + + ```bash {{ filename: 'terminal' }} + pnpm dev + ``` + + + Visit your new custom page locally at [localhost:3000/sign-up](http://localhost:3000/sign-up). + + +## Next steps + + + - [Read user and session data](/docs/references/nextjs/read-session-data) + - Learn how to use Clerk's hooks and helpers to access the active session and user data in your Next.js application. + + --- + + - [Client-side helpers](/docs/references/nextjs/overview#client-side-helpers) + - Learn more about Next.js client-side helpers and how to use them. + + --- + + - [Next.js SDK Reference](/docs/references/nextjs/overview) + - Learn more about additional Next.js methods. + + --- + + - [Clerk components](/docs/components/overview) + - Learn more about Clerk's prebuilt components that make authentication and user management easy. + diff --git a/docs/references/nextjs/waitlist.mdx b/docs/references/nextjs/waitlist.mdx index f4012afc5a..5649370a31 100644 --- a/docs/references/nextjs/waitlist.mdx +++ b/docs/references/nextjs/waitlist.mdx @@ -146,7 +146,7 @@ In [**Waitlist** mode](/docs/authentication/configuration/restrictions#waitlist) } ``` - Update your environment variables to point to your custom sign-in page. For more information on building custom sign-in and sign-up pages, see the [dedicated guide](/docs/references/nextjs/custom-signup-signin-pages). + Update your environment variables to point to your custom sign-in page. For more information on building a custom sign-in-or-up page, see the [dedicated guide](/docs/references/nextjs/custom-sign-in-or-up-page). ```env {{ filename: '.env.local' }} NEXT_PUBLIC_CLERK_SIGN_IN_URL="/sign-in" diff --git a/docs/references/react-router/custom-sign-in-or-up-page.mdx b/docs/references/react-router/custom-sign-in-or-up-page.mdx new file mode 100644 index 0000000000..2b95e62986 --- /dev/null +++ b/docs/references/react-router/custom-sign-in-or-up-page.mdx @@ -0,0 +1,76 @@ +--- +title: Build your own sign-in-or-up page for your React Router app with Clerk +description: Learn how to add a custom sign-in-or-up page to your React Router app with Clerk's prebuilt components. +--- + +This guide shows you how to use the [``](/docs/components/authentication/sign-in) component with the [React Router Splat route](https://reactrouter.com/start/framework/routing#splats) in order to build a custom page for your Next.js app that allows users to sign in or sign up within a single flow. + +If the prebuilt components don’t fully meet your needs or you want greater control over the logic, you can recreate Clerk’s existing flows using the Clerk API. For more information, see the [custom flow guides](/docs/custom-flows/overview). + + + ## Build a sign-in-or-up page + + The following example demonstrates how to render the [``](/docs/components/authentication/sign-up) component to allow users to both sign-in or sign-up from a single flow. + + ```tsx {{ filename: 'app/routes/sign-in.tsx' }} + import { SignIn } from '@clerk/react-router' + + export default function SignInPage() { + return ( +
+

Sign in or up route

+ +
+ ) + } + ``` + + ## Configure routes + + React Router expects you to define routes in [`app/routes.ts`](https://reactrouter.com/start/framework/routing). Add the previously created sign-in-or-up page to your route configuration. + + ```tsx {{ filename: 'app/routes.ts', mark: [5] }} + import { type RouteConfig, index, route } from '@react-router/dev/routes' + + export default [ + index('routes/home.tsx'), + route('sign-in/*', 'routes/sign-in.tsx'), + ] satisfies RouteConfig + ``` + + ## Configure redirect behavior + + Update your environment variables to point to your custom sign-in-or-up page. Learn more about the available [environment variables](/docs/deployments/clerk-environment-variables). + + ```env {{ filename: '.env' }} + CLERK_SIGN_IN_FALLBACK_URL=/ + CLERK_SIGN_IN_URL=/sign-in + ``` + + ## Visit your new page + + Run your project with the following command: + + + ```bash {{ filename: 'terminal' }} + npm run dev + ``` + + ```bash {{ filename: 'terminal' }} + yarn dev + ``` + + ```bash {{ filename: 'terminal' }} + pnpm dev + ``` + + + Visit your new custom page locally at [localhost:5173/sign-in](http://localhost:5173/sign-in). +
+ +## Next steps + + + - [Custom sign-up page](/docs/references/react-router/custom-sign-up-page) + - Learn how to add a custom sign-up page to your React Router app with Clerk's prebuilt components. + diff --git a/docs/references/react-router/custom-signup-signin-pages.mdx b/docs/references/react-router/custom-sign-up-page.mdx similarity index 54% rename from docs/references/react-router/custom-signup-signin-pages.mdx rename to docs/references/react-router/custom-sign-up-page.mdx index a2f6d1be2d..e6568f97e8 100644 --- a/docs/references/react-router/custom-signup-signin-pages.mdx +++ b/docs/references/react-router/custom-sign-up-page.mdx @@ -1,9 +1,9 @@ --- -title: Build your own sign-up and sign-in pages for your React Router app with Clerk -description: Learn how to add custom sign-up and sign-in pages to your React Router app with Clerk's prebuilt components. +title: Build your own sign-up page for your React Router app with Clerk +description: Learn how to add a custom sign-up page to your React Router app with Clerk's prebuilt components. --- -This guide shows you how to use the [``](/docs/components/authentication/sign-in) and [``](/docs/components/authentication/sign-up) components with the [React Router Splat route](https://reactrouter.com/start/framework/routing#splats) to build custom sign-up and sign-in pages for your React Router app. See the [quickstart tutorial](/docs/quickstarts/react-router) for a step-by-step guide. +By default, the [``](/docs/references/react-router/custom-sign-in-or-up-page) component handles signing-in or signing-up, but if you'd like to have a dedicated sign-up page, this guide shows you how to use the [``](/docs/components/authentication/sign-up) component with the [React Router Splat route](https://reactrouter.com/start/framework/routing#splats) in order to build custom sign-up page for your React Router app. If the prebuilt components don't meet your specific needs or if you require more control over the logic, you can rebuild the existing Clerk flows using the Clerk API. For more information, see the [custom flow guides](/docs/custom-flows/overview). @@ -25,28 +25,11 @@ If the prebuilt components don't meet your specific needs or if you require more } ``` - ## Build a sign-in page - - The following example demonstrates how to render the [``](/docs/components/authentication/sign-in) component. - - ```tsx {{ filename: 'app/routes/sign-in.tsx' }} - import { SignIn } from '@clerk/react-router' - - export default function SignInPage() { - return ( -
-

Sign in route

- -
- ) - } - ``` - ## Configure routes - React Router expects you to define routes in [`app/routes.ts`](https://reactrouter.com/start/framework/routing). Add the previously created sign-in and sign-up pages to your route configuration. + React Router expects you to define routes in [`app/routes.ts`](https://reactrouter.com/start/framework/routing). Add the previously created sign-up page to your route configuration. - ```tsx {{ filename: 'app/routes.ts', mark: [5, 6] }} + ```tsx {{ filename: 'app/routes.ts', mark: [6] }} import { type RouteConfig, index, route } from '@react-router/dev/routes' export default [ @@ -58,18 +41,18 @@ If the prebuilt components don't meet your specific needs or if you require more ## Configure redirect behavior - Update your environment variables to point to your custom sign-up and sign-in pages. Learn more about the available [environment variables](/docs/deployments/clerk-environment-variables). + Update your environment variables to point to your custom sign-up page. Learn more about the available [environment variables](/docs/deployments/clerk-environment-variables). - ```env {{ filename: '.env' }} - CLERK_SIGN_IN_URL=/sign-in - CLERK_SIGN_UP_URL=/sign-up + ```env {{ filename: '.env', mark: [2, 4] }} CLERK_SIGN_IN_FALLBACK_REDIRECT_URL=/ CLERK_SIGN_UP_FALLBACK_REDIRECT_URL=/ + CLERK_SIGN_IN_URL=/sign-in + CLERK_SIGN_UP_URL=/sign-up ``` These values control the behavior of the `` and `` components and when you visit the respective links at the bottom of each component. - ## Visit your new pages + ## Visit your new page Run your project with the following command: @@ -87,5 +70,5 @@ If the prebuilt components don't meet your specific needs or if you require more ``` - Visit your new custom pages locally at [localhost:5173/sign-up](http://localhost:5173/sign-up) and [localhost:5173/sign-in](http://localhost:5173/sign-in). + Visit your new custom page locally at [localhost:5173/sign-up](http://localhost:5173/sign-up). diff --git a/docs/references/remix/custom-sign-in-or-up-page.mdx b/docs/references/remix/custom-sign-in-or-up-page.mdx new file mode 100644 index 0000000000..6e210a6668 --- /dev/null +++ b/docs/references/remix/custom-sign-in-or-up-page.mdx @@ -0,0 +1,82 @@ +--- +title: Build your own sign-in-or-up page for your Remix app with Clerk +description: Learn how to add a custom sign-in-or-up page to your Remix app with Clerk's prebuilt components. +--- + +This guide shows you how to use the [``](/docs/components/authentication/sign-in) component with the [Remix optional route](https://reactrouter.com/en/main/route/route#optional-segments) in order to build a custom page for that allows users to sign in or sign up within a single flow for your Remix app. + +If Clerk's prebuilt components don't meet your specific needs or if you require more control over the logic, you can rebuild the existing Clerk flows using the Clerk API. For more information, see the [custom flow guides](/docs/custom-flows/overview). + +> [!NOTE] +> Just getting started with Clerk and Remix? See the [quickstart tutorial](/docs/quickstarts/remix)! + + + ## Build a sign-in-or-up page + + The following example demonstrates how to render the [``](/docs/components/authentication/sign-up) component to allow users to both sign-in or sign-up from a single flow. + + ```tsx {{ filename: 'app/routes/sign-in.$.tsx' }} + import { SignIn } from '@clerk/remix' + + export default function Page() { + return + } + ``` + + ## Configure your sign-in-or-up page + + + + For SSR Mode, add environment variables for the `signIn` and `afterSignIn` paths: + + ```env {{ filename: '.env' }} + CLERK_SIGN_IN_URL=/sign-in + CLERK_SIGN_IN_FALLBACK_URL=/ + ``` + + + + For SPA Mode, add paths to your `ClerkApp` options to control the behavior of the components when you sign in or sign up and when you click on the respective links at the bottom of each component. + + ```ts {{ filename: 'app/root.tsx', mark: [[3, 4]] }} + export default ClerkApp(App, { + publishableKey: PUBLISHABLE_KEY, + signInUrl: '/sign-in', + signInFallbackRedirectUrl: '/', + }) + ``` + + + + ## Visit your new page + + Run your project with the following terminal command from the root directory of your project: + + + ```bash {{ filename: 'terminal' }} + npm run dev + ``` + + ```bash {{ filename: 'terminal' }} + yarn dev + ``` + + ```bash {{ filename: 'terminal' }} + pnpm dev + ``` + + + Visit your new custom page locally at [localhost:3000/sign-in](http://localhost:3000/sign-in). + + +## Next steps + + + - [Custom sign-up page](/docs/references/remix/custom-sign-up-page) + - Learn how to add a custom sign-up page to your Remix app with Clerk's prebuilt components. + + --- + + - [Read user and session data](/docs/references/remix/read-session-data) + - Learn how to use Clerk's hooks and helpers to access the active session and user data in your Remix application. + diff --git a/docs/references/remix/custom-sign-up-page.mdx b/docs/references/remix/custom-sign-up-page.mdx new file mode 100644 index 0000000000..8ca3595905 --- /dev/null +++ b/docs/references/remix/custom-sign-up-page.mdx @@ -0,0 +1,81 @@ +--- +title: Build your own sign-up page for your Remix app with Clerk +description: Learn how to add a custom sign-up page to your Remix app with Clerk's prebuilt components. +--- + +By default, the [``](/docs/references/remix/custom-sign-in-or-up-page) component handles signing-in or signing-up, but if you'd like to have a dedicated sign-up page, this guide shows you how to use the [``](/docs/components/authentication/sign-up) component with the [Next.js optional catch-all route](https://reactrouter.com/en/main/route/route#optional-segments) in order to build custom sign-up page for your Remix app. + +If the prebuilt components don't meet your specific needs or if you require more control over the logic, you can rebuild the existing Clerk flows using the Clerk API. For more information, see the [custom flow guides](/docs/custom-flows/overview). + +> [!NOTE] +> Just getting started with Clerk and Next.js? See the [quickstart tutorial](/docs/quickstarts/remix)! + + + ## Build a sign-up page + + The following example demonstrates how to render the [``](/docs/components/authentication/sign-up) component. + + ```tsx {{ filename: 'app/routes/sign-up.$.tsx' }} + import { SignUp } from '@clerk/remix' + + export default function Page() { + return + } + ``` + + ## Configure your sign-up page + + + + For SSR Mode, add environment variables for the `signUp` and `afterSignUp` paths: + + ```env {{ filename: '.env', mark: [2, 4] }} + CLERK_SIGN_IN_URL=/sign-in + CLERK_SIGN_UP_URL=/sign-up + CLERK_SIGN_IN_FALLBACK_URL=/ + CLERK_SIGN_UP_FALLBACK_URL=/ + ``` + + + + For SPA Mode, add paths to your `ClerkApp` options to control the behavior of the components when you sign in or sign up and when you click on the respective links at the bottom of each component. + + ```ts {{ filename: 'app/root.tsx', mark: [4, 6] }} + export default ClerkApp(App, { + publishableKey: PUBLISHABLE_KEY, + signInUrl: '/sign-in', + signUpUrl: '/sign-up', + signInFallbackRedirectUrl: '/', + signUpFallbackRedirectUrl: '/', + }) + ``` + + + + ## Visit your new page + + Run your project with the following command: + + + ```bash {{ filename: 'terminal' }} + npm run dev + ``` + + ```bash {{ filename: 'terminal' }} + yarn dev + ``` + + ```bash {{ filename: 'terminal' }} + pnpm dev + ``` + + + Visit your new custom page locally at [localhost:3000/sign-up](http://localhost:3000/sign-up). + + +## Next steps + + + - [Read user and session data](/docs/references/remix/read-session-data) + - Learn how to use Clerk's hooks and helpers to access the active session and user data in your Remix application. + diff --git a/docs/references/remix/custom-signup-signin-pages.mdx b/docs/references/remix/custom-signup-signin-pages.mdx deleted file mode 100644 index 173cfc83bc..0000000000 --- a/docs/references/remix/custom-signup-signin-pages.mdx +++ /dev/null @@ -1,107 +0,0 @@ ---- -title: Build your own sign-in and sign-up pages for your Remix app with Clerk -description: Learn how to add custom sign-in and sign-up pages to your Remix app with Clerk's prebuilt components. ---- - -This guide shows you how to use the [``](/docs/components/authentication/sign-in) and [``](/docs/components/authentication/sign-up) components with the [Remix optional route](https://reactrouter.com/en/main/route/route#optional-segments) in order to build custom sign-in and sign-up pages for your Remix app. - -If Clerk's prebuilt components don't meet your specific needs or if you require more control over the logic, you can rebuild the existing Clerk flows using the Clerk API. For more information, see the [custom flow guides](/docs/custom-flows/overview). - -The functionality of the components are controlled by the instance settings you specify in the [Clerk Dashboard](https://dashboard.clerk.com). - -> [!NOTE] -> Just getting started with Clerk and Remix? See the [quickstart tutorial](/docs/quickstarts/remix)! - - - ## Build your sign-up page - - The following example demonstrates how to render the [``](/docs/components/authentication/sign-up) component. - - ```tsx {{ filename: 'app/routes/sign-up.$.tsx' }} - import { SignUp } from '@clerk/remix' - - export default function SignUpPage() { - return ( -
-

Sign Up route

- -
- ) - } - ``` - - ## Build your sign-in page - - The following example demonstrates how to render the [``](/docs/components/authentication/sign-in) component. - - ```tsx {{ filename: 'app/routes/sign-in.$.tsx' }} - import { SignIn } from '@clerk/remix' - - export default function SignInPage() { - return ( -
-

Sign In route

- -
- ) - } - ``` - - ## Configure your sign-up and sign-in pages - - - - For SSR Mode, add environment variables for the `signIn`, `signUp`, `afterSignUp`, and `afterSignIn` paths: - - ```env {{ filename: '.env' }} - CLERK_SIGN_IN_URL=/sign-in - CLERK_SIGN_UP_URL=/sign-up - CLERK_SIGN_IN_FALLBACK_REDIRECT_URL=/ - CLERK_SIGN_UP_FALLBACK_REDIRECT_URL=/ - ``` - - - - For SPA Mode, add paths to your `ClerkApp` options to control the behavior of the components when you sign in or sign up and when you click on the respective links at the bottom of each component. - - ```ts {{ filename: 'app/root.tsx', mark: [[3, 6]] }} - export default ClerkApp(App, { - publishableKey: PUBLISHABLE_KEY, - signInUrl: '/sign-in', - signUpUrl: '/sign-up', - signInFallbackRedirectUrl: '/', - signUpFallbackRedirectUrl: '/', - }) - ``` - - - - These values control the behavior of the components when you sign in or sign up and when you click on the respective links at the bottom of each component. - - ## Visit your new pages - - Run your project with the following terminal command from the root directory of your project: - - - ```bash {{ filename: 'terminal' }} - npm run dev - ``` - - ```bash {{ filename: 'terminal' }} - yarn dev - ``` - - ```bash {{ filename: 'terminal' }} - pnpm dev - ``` - - - Visit your new custom pages locally at [localhost:3000/sign-in](http://localhost:3000/sign-in) and [localhost:3000/sign-up](http://localhost:3000/sign-up). -
- -## Next steps - - - - [Read user and session data](/docs/references/remix/read-session-data) - - Learn how to use Clerk's hooks and helpers to access the active session and user data in your Remix application. - diff --git a/docs/references/tanstack-start/custom-sign-in-or-up-page.mdx b/docs/references/tanstack-start/custom-sign-in-or-up-page.mdx new file mode 100644 index 0000000000..5aa3e58f9d --- /dev/null +++ b/docs/references/tanstack-start/custom-sign-in-or-up-page.mdx @@ -0,0 +1,71 @@ +--- +title: Build your own sign-in-or-up page for your TanStack Start app with Clerk +description: Learn how to add a custom sign-in-or-up page to your TanStack Start app with Clerk's prebuilt components. +--- + +This guide shows you how to use the [``](/docs/components/authentication/sign-in) component with the [Tanstack Router catch-all route](https://tanstack.com/router/latest/docs/framework/react/guide/code-based-routing#splat--catch-all-routes) in order to build a custom page for your TanStack Start app that allows users to sign in or sign up within a single flow. + +If Clerk's prebuilt components don't meet your specific needs or if you require more control over the logic, you can rebuild the existing Clerk flows using the Clerk API. For more information, see the [custom flow guides](/docs/custom-flows/overview). + +> [!NOTE] +> Just getting started with Clerk and TanStack Start? See the [quickstart tutorial](/docs/quickstarts/tanstack-start)! + + + ## Build a sign-in-or-up page + + The following example demonstrates how to render the [``](/docs/components/authentication/sign-up) component to allow users to both sign-in or sign-up from a single flow. + + ```tsx {{ filename: 'app/routes/sign-in.$.tsx' }} + import { SignIn } from '@clerk/tanstack-start' + import { createFileRoute } from '@tanstack/react-router' + + export const Route = createFileRoute('/sign-in/$')({ + component: Page, + }) + + function Page() { + return + } + ``` + + ## Configure your sign-in-or-up page + + To tell Clerk where to find your sign-in-or-up page, set the following [environment variables](/docs/deployments/clerk-environment-variables#sign-in-and-sign-up-redirects): + + ```env {{ filename: '.env' }} + CLERK_SIGN_IN_URL=/sign-in + CLERK_SIGN_IN_FALLBACK_REDIRECT_URL=/ + ``` + + ## Visit your new page + + Run your project with the following command: + + + ```bash {{ filename: 'terminal' }} + npm run dev + ``` + + ```bash {{ filename: 'terminal' }} + yarn dev + ``` + + ```bash {{ filename: 'terminal' }} + pnpm dev + ``` + + + Visit your new custom page locally at [localhost:3000/sign-in](http://localhost:3000/sign-in). + + +## Next steps + + + - [Create custom sign-up page](/docs/references/tanstack-start/custom-sign-up-page) + - Learn how to add a custom sign-up page to your TanStack Start app with Clerk's prebuilt components. + + --- + + - [Read user and session data](/docs/references/tanstack-start/read-session-data) + - Learn how to use Clerk's hooks and helpers to access the active session and user data in your TanStack Start application. + diff --git a/docs/references/tanstack-start/custom-signup-signin-pages.mdx b/docs/references/tanstack-start/custom-sign-up-page.mdx similarity index 51% rename from docs/references/tanstack-start/custom-signup-signin-pages.mdx rename to docs/references/tanstack-start/custom-sign-up-page.mdx index 3abd5ac433..86e125a0a4 100644 --- a/docs/references/tanstack-start/custom-signup-signin-pages.mdx +++ b/docs/references/tanstack-start/custom-sign-up-page.mdx @@ -1,9 +1,9 @@ --- -title: Build your own sign-in and sign-up pages for your TanStack Start app with Clerk -description: Learn how to add custom sign-in and sign-up pages to your TanStack Start app with Clerk's prebuilt components. +title: Build your own sign-up page for your TanStack Start app with Clerk +description: Learn how to add a custom sign-up page to your TanStack Start app with Clerk's prebuilt components. --- -This guide shows you how to use the [``](/docs/components/authentication/sign-in) and [``](/docs/components/authentication/sign-up) components with the [TanStack Router Catch-All Routes](https://tanstack.com/router/latest/docs/framework/react/guide/code-based-routing#splat--catch-all-routes) in order to build custom sign-in and sign-up pages for your TanStack Start app. +By default, the [``](/docs/references/nextjs/custom-sign-in-or-up-page) component handles signing-in or signing-up, but if you'd like to have a dedicated sign-up page, this guide shows you how to use the [``](/docs/components/authentication/sign-up) component with the [TanStack Router catch-all route](https://tanstack.com/router/latest/docs/framework/react/guide/code-based-routing#splat--catch-all-routes) in order to build custom sign-up page for your TanStack Start app. If Clerk's prebuilt components don't meet your specific needs or if you require more control over the logic, you can rebuild the existing Clerk flows using the Clerk API. For more information, see the [custom flow guides](/docs/custom-flows/overview). @@ -28,28 +28,11 @@ If Clerk's prebuilt components don't meet your specific needs or if you require } ``` - ## Build a sign-in page + ## Configure your sign-up page - The following example demonstrates how to render the [``](/docs/components/authentication/sign-in) component. + To tell Clerk where to find your sign-up page, set the following [environment variables](/docs/deployments/clerk-environment-variables#sign-in-and-sign-up-redirects): - ```tsx {{ filename: 'app/routes/sign-in.$.tsx' }} - import { SignIn } from '@clerk/tanstack-start' - import { createFileRoute } from '@tanstack/react-router' - - export const Route = createFileRoute('/sign-in/$')({ - component: Page, - }) - - function Page() { - return - } - ``` - - ## Configure your sign-up and sign-in pages - - To tell Clerk where to find your sign-in and sign-up pages, set the following [environment variables](/docs/deployments/clerk-environment-variables#sign-in-and-sign-up-redirects): - - ```env {{ filename: '.env' }} + ```env {{ filename: '.env', mark: [2, 4] }} CLERK_SIGN_IN_URL=/sign-in CLERK_SIGN_UP_URL=/sign-up CLERK_SIGN_IN_FALLBACK_REDIRECT_URL=/ @@ -74,7 +57,7 @@ If Clerk's prebuilt components don't meet your specific needs or if you require ``` - Visit your new custom pages locally at [localhost:3000/sign-in](http://localhost:3000/sign-in) and [localhost:3000/sign-up](http://localhost:3000/sign-up). + Visit your new custom page locally at [localhost:3000/sign-up](http://localhost:3000/sign-up). ## Next steps diff --git a/docs/references/tanstack-start/overview.mdx b/docs/references/tanstack-start/overview.mdx index f112908324..507aeb4c1c 100644 --- a/docs/references/tanstack-start/overview.mdx +++ b/docs/references/tanstack-start/overview.mdx @@ -8,7 +8,7 @@ The Clerk TanStack Start SDK is built on top of the [React SDK](/docs/references ## Guides - [Read session and user data](/docs/references/tanstack-start/read-session-data) -- [Add custom sign up and sign in pages](/docs/references/tanstack-start/custom-signup-signin-pages) +- [Add custom sign-in-or-up page](/docs/references/tanstack-start/custom-sign-in-or-up-page) ## Client-side helpers diff --git a/docs/users/invitations.mdx b/docs/users/invitations.mdx index 2a08bddbad..045750c6fb 100644 --- a/docs/users/invitations.mdx +++ b/docs/users/invitations.mdx @@ -5,7 +5,7 @@ description: Learn how to invite users to your Clerk application. Inviting users to your Clerk application allows you to onboard new users seamlessly by sending them a unique invitation link. -Once you create an invitation, Clerk sends an email to the invited user with a unique invitation link. When the user visits the invitation link, they will be redirected to the [Account Portal sign-up page](/docs/customization/account-portal/overview#sign-up) and **their email address will be automatically verified.** If you want to redirect the user to a specific page in your application, you can [specify a redirect URL when creating the invitation](#redirect-url). +Once you create an invitation, Clerk sends an email to the invited user with a unique invitation link. When the user visits the invitation link, they will be redirected to the [Account Portal sign-up page](/docs/customization/account-portal/overview#sign-in-or-up) and **their email address will be automatically verified.** If you want to redirect the user to a specific page in your application, you can [specify a redirect URL when creating the invitation](#redirect-url). Invitations expire after a month. If the user clicks on an expired invitation, they will get redirected to the application's sign-up page and will have to go through the normal sign-up flow. Their email address will not be auto-verified.