Skip to main content

If you are using our backend SDK that is lesser than the following versions, please visit the older documentation link here.

Which UI do you use?
Custom UI
Pre built UI

Overview steps

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 /auth by default)
  • Creating a serverless function to expose the auth related APIs which will be consumed by the frontend widgets (on /api/auth/ by default)
  • 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
    • In your frontend routes

Try an example app #

Download and run an example NextJS app quickly using the following command:

npx create-supertokens-app@latest --frontend=next --recipe=thirdpartyemailpassword

Follow our video guide #

Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI