Backend Integration
#
Example- NodeJS
- GoLang
- Python
#
1) Install- NodeJS
- GoLang
- Python
npm i -s supertokens-node
go get github.com/supertokens/supertokens-golang
pip install supertokens-python
#
2) Initialise SuperTokensPlease 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.
#
3) Initialise Social login providersPlease fill the form below to see the code snippet (* = Required)
To learn more about what these properties mean read here.
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.
#
4) Add the SuperTokens APIs & CORS setupPlease fill the form below to see the code snippet (* = Required)
To learn more about what these properties mean read here.
API Base Path:

SuperTokens will expose it's APIs scoped by this base API path.
Website Domain:*

This is the URL of your website.
#
5) Add the SuperTokens error handlerAdd the errorHandler
AFTER all your routes, but BEFORE your error handler
- NodeJS
- GoLang
- Python
- Express
- Hapi
- Fastify
- Koa
- Loopback
- Serverless
- Next.js
- Nest.js
info
Please refer the Serverless Deployment section (Towards the bottom of the navigation index)
info
Please refer the NextJS section (Towards the bottom of the navigation index)
info
Please refer the NestJS section (Towards the bottom of the navigation index)
import express, { Request, Response, NextFunction } from "express";import { errorHandler } from "supertokens-node/framework/express";
let app = express();// ...your API routes
// Add this AFTER all your routesapp.use(errorHandler())
// your own error handlerapp.use((err: unknown, req: Request, res: Response, next: NextFunction) => { /* ... */ });
No additional errorHandler
is required.
Add the errorHandler
Before all your routes and plugin registration
import Fastify from "fastify";import { errorHandler } from "supertokens-node/framework/fastify";
let fastify = Fastify();
fastify.setErrorHandler(errorHandler());
// ...your API routes
No additional errorHandler
is required.
No additional errorHandler
is required.
info
You can skip this step
info
You can skip this step
#
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 coreAre you using
https://try.supertokens.com
as the connection URI in the init function?YesNo