Skip to main content

Backend Integration

Example#

An example implementation can be found here.

1) Install#

npm i -s supertokens-node

2) Initialise SuperTokens#

Please fill the form below to see the code snippet (* = Required)
Your app's name:*
This is the name of your application
API Domain:*
This is the URL of your app's API domain, without any path.
Website Domain:*
This is the URL of your website, without any path.
Fill form to submit

3) Initialise Social login providers#

Please fill the form below to see the code snippet (* = Required)
API Domain:*
This is the URL of your app's API domain, without any path.
Website Domain:*
This is the URL of your website, without any path.
Fill form to submit

4) Add the SuperTokens APIs & CORS setup#

Please fill the form below to see the code snippet (* = Required)
Website Domain:*
This is the URL of your website, without any path.
Fill form to submit

5) Add the SuperTokens error handler#

let {errorHandler} = require("supertokens-node/framework/express");// ...your API routes
// Add this AFTER all your routesapp.use(errorHandler())
// your own error handlerapp.use((err, req, res, next) => {...});

6) Test if sign up is setup correctly#

  • Visit the login form on the website.
  • Try to sign up.
  • If after signing up, you are redirected to /, everything is setup correctly 😁
  • If not, you can always ask for help via Github issues or via our Discord

7) Setup the SuperTokens core#

Are you using https://try.supertokens.io as the connection URI in the init function?
YesNo
Refresh the page to undo your selection