Skip to main content

Frontend Integration

important

For framework specific implementation (like Next.js), please skip this section and go directly to the section with the name of your framework.

An example implementation can be found here.#

1) Install#

npm i -s supertokens-auth-react

2) Call the init function#

Please fill the form below to see the code snippet (* = Required)
To learn more about what these properties mean read here.
Your app's name:*
This is the name of your application
API Domain:*
This is the URL of your app's API server.
API Base Path:
SuperTokens will expose it's APIs scoped by this base API path.
Website Domain:*
This is the URL of your website.
Website Base Path:
SuperTokens UI will be shown on this website route.
Submit form

3) Setup the login UI#

Please fill the form below to see the code snippet (* = Required)
To learn more about what these properties mean read here.
Website Base Path:
SuperTokens UI will be shown on this website route.
Submit form

4) Add API interceptors for automatic session refreshing#

Do you use axios on your frontend?
YesNo
Refresh the page to undo your selection

5) View the login UI (ReactJS only)#

Please fill the form below to see the code snippet (* = Required)
To learn more about what these properties mean read here.
Website Base Path:
SuperTokens UI will be shown on this website route.
Submit form