Skip to main content
Version: 6.1.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({    supertokens?: {        connectionURI: string,        apiKey?: string    };    appInfo: {        appName: string,        apiDomain: string,        websiteDomain: string,        apiBasePath?: string,        websiteBasePath?: string,        apiGatewayPath?: string    },    recipeList: RecipeListFunction[],    isInServerlessEnv?: boolean})

Parameters#

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.
Which frontend SDK do you use?
supertokens-web-js / mobile
supertokens-auth-react