2. Backend config
#
1) Install supertokens packagenpm i supertokens-node
config/supertokensConfig.js
)#
2) Create a configuration file (- Create a
config
folder in the root directory of your project. - Create a
supertokensConfig.js
inside theconfig
folder. - An example of this file can be found here.
#
3) Create a backend config function- Single app setup
- Multi app setup
/config/supertokensConfig.ts
import Session from 'supertokens-node/recipe/session'
function getBackendConfig() {
return {
framework: "awsLambda",
supertokens: {
connectionURI: "",
apiKey: "",
},
appInfo: {
// learn more about this on https://supertokens.com/docs/session/appinfo
appName: "<YOUR_APP_NAME>",
apiDomain: "<YOUR_API_DOMAIN>",
websiteDomain: "<YOUR_WEBSITE_DOMAIN>",
apiBasePath: "/auth",
websiteBasePath: "/auth"
},
recipeList: [
Session.init()
],
isInServerlessEnv: true,
}
}
module.exports.getBackendConfig = getBackendConfig;
/config/supertokensConfig.ts
import Session from 'supertokens-node/recipe/session'
function getBackendConfig() {
return {
framework: "awsLambda",
supertokens: {
connectionURI: "",
apiKey: "",
},
appInfo: {
// learn more about this on https://supertokens.com/docs/session/appinfo
appName: "<YOUR_APP_NAME>",
apiDomain: "<YOUR_API_DOMAIN>",
websiteDomain: "<YOUR_WEBSITE_DOMAIN>",
apiBasePath: "/auth",
websiteBasePath: "/auth"
},
recipeList: [
Session.init()
],
isInServerlessEnv: true,
}
}
module.exports.getBackendConfig = getBackendConfig;