|
| 1 | +--- |
| 2 | +id: about |
| 3 | +title: About |
| 4 | +hide_title: true |
| 5 | +show_ui_switcher: true |
| 6 | +--- |
| 7 | + |
| 8 | +<!-- COPY DOCS --> |
| 9 | +<!-- ./thirdpartyemailpassword/nextjs/app-directory/about.mdx --> |
| 10 | + |
| 11 | +import {PreBuiltOrCustomUISwitcher, PreBuiltUIContent, CustomUIContent} from "/src/components/preBuiltOrCustomUISwitcher" |
| 12 | + |
| 13 | +<PreBuiltOrCustomUISwitcher> |
| 14 | + |
| 15 | +<PreBuiltUIContent> |
| 16 | + |
| 17 | +# Overview steps |
| 18 | + |
| 19 | +Integrating SuperTokens with a Next.js app involves: |
| 20 | +- Calling the frontend and backend init functions |
| 21 | +- Adding a website page to display the auth related widgets (on `/auth` by default) |
| 22 | +- Creating a serverless function to expose the auth related APIs which will be consumed by the frontend widgets (on `/api/auth/` by default) |
| 23 | +- Protecting website routes: Displaying them only when a user is logged in, else redirecting them to the login page |
| 24 | +- Performing session verification: |
| 25 | + - In your APIs |
| 26 | + - In your frontend routes |
| 27 | + |
| 28 | +## Try an example app |
| 29 | +Download and run an example NextJS app quickly using the following command: |
| 30 | + |
| 31 | +```bash |
| 32 | +npx create-supertokens-app@latest --frontend=next --recipe=^{codeImportRecipeName} |
| 33 | +``` |
| 34 | + |
| 35 | +</PreBuiltUIContent> |
| 36 | + |
| 37 | +<CustomUIContent> |
| 38 | + |
| 39 | +# Overview steps |
| 40 | + |
| 41 | +Integrating SuperTokens with a Next.js app involves: |
| 42 | +- Calling the frontend and backend init functions |
| 43 | +- Building the various auth flows as per the [custom UI setup guide](../custom-ui/init/frontend). |
| 44 | +- Creating a serverless function to expose the auth related APIs which will be consumed by the frontend widgets (on `/api/auth/` by default) |
| 45 | +- Protecting website routes: Displaying them only when a user is logged in, else redirecting them to the login page |
| 46 | +- Performing session verification: |
| 47 | + - In your APIs |
| 48 | + - In your frontend routes |
| 49 | + |
| 50 | +## Try an example app |
| 51 | + |
| 52 | +Download and run an example NextJS app quickly using the following command: |
| 53 | + |
| 54 | +```bash |
| 55 | +npx create-supertokens-app@latest --frontend=next --recipe=^{codeImportRecipeName} |
| 56 | +``` |
| 57 | + |
| 58 | +:::note |
| 59 | +This example app uses our pre built UI |
| 60 | +::: |
| 61 | + |
| 62 | + |
| 63 | +</CustomUIContent> |
| 64 | + |
| 65 | +</PreBuiltOrCustomUISwitcher> |
0 commit comments