Skip to main content
Which frontend SDK do you use?
supertokens-web-js / mobile
supertokens-auth-react

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 getServerSideProps

Try an example app #

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

npx [email protected] --frontend=next --recipe=emailpassword
Which frontend SDK do you use?
supertokens-web-js / mobile
supertokens-auth-react