This SDK documentation is outdated. Please do not refer to it, and instead visit the User Guides section.

Skip to main content
Version: 7.0.X

Supertokens.init(config)

In your index.js, you need to call the Supertokens.init function to initialise SuperTokens. You can provide it the following config:

import supertokens from "supertokens-node";

Supertokens.init({
framework?: string,
supertokens?: {
connectionURI: string,
apiKey?: string
};
appInfo: {
appName: string,
apiDomain: string,
websiteDomain: string,
apiBasePath?: string,
websiteBasePath?: string,
apiGatewayPath?: string
},
recipeList: RecipeListFunction[],
isInServerlessEnv?: boolean
})

Parameters#

framework (Optional)#

  • Pass the value of framework this library is used in. For next.js, use express. Currently supported values are:
    • express
    • koa
    • hapi
    • fastify
    • loopback
    • awsLambda
  • Default: express

supertokens (Optional)#

  • connectionURI
    • The url link to supertokens core. If you are using Supertokens Saas service, you can find the connectionURI on your app's dashboard.
  • apiKey (Optional)
    • Use this to authenticate the backend APIs with the supertokens core
    • Default: undefined

appInfo#

  • You can learn more about the appInfo object in the recipe guides.

isInServerlessEnv(Optional)#

  • Pass true if you are using this library in a serverless environment as it will help to optimise the performance.
  • Default: false

recipeList#

  • List of Recipes you want to use. You need to pass atleast one Recipe to ths array. For more info on Recipes, checkout this link) or the other sections in this docs.
Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI