Integrating SuperTokens with a Next.js app involves:
- Calling the frontend and backend init functions
- Adding a website page to display the auth related widgets (on
- Creating a serverless function to expose the auth related APIs which will be consumed by the frontend widgets (on
- Protecting website routes: Displaying them only when a user is logged in, else redirecting them to the login page
- Performing session verification:
- In your APIs
Each of these will be covered in the next few pages. Rest of the customizations can be done by following the "Common customizations" section.
This example uses the "Thirdpartyemailpassword recipe".
You can use the above as a starting point by:
npx create-next-app --example with-supertokens with-supertokens-app # or yarn create next-app --example with-supertokens with-supertokens-app