Skip to content

Instantly share code, notes, and snippets.

@aaishikasb
Created March 9, 2022 16:26
Show Gist options
  • Save aaishikasb/2bae0b96dd5f46144e6d4a3a35bf6d60 to your computer and use it in GitHub Desktop.
Save aaishikasb/2bae0b96dd5f46144e6d4a3a35bf6d60 to your computer and use it in GitHub Desktop.
This Gist is a part of the "Implementing Passwordless Login Using SuperTokens in React" article on Medium.
import supertokens from "supertokens-node";
import Session from "supertokens-node/recipe/session";
import Passwordless from "supertokens-node/recipe/passwordless";
supertokens.init({
framework: "express",
supertokens: {
// try.supertokens.com is for demo purposes. Replace this with the address of your core instance (sign up on supertokens.com), or self host a core.
connectionURI: "https://try.supertokens.com",
// apiKey: "IF YOU HAVE AN API KEY FOR THE CORE, ADD IT HERE",
},
appInfo: {
// learn more about this on https://supertokens.com/docs/session/appinfo
appName: "supertokens-passwordless",
apiDomain: "https://localhost:8000",
websiteDomain: "https://localhost:3000",
apiBasePath: "/auth",
websiteBasePath: "/auth"
},
recipeList: [
Passwordless.init({
flowType: "USER_INPUT_CODE",
contactMethod: "EMAIL_OR_PHONE",
createAndSendCustomEmail: async (input, context) => { /* See next step */ },
createAndSendCustomTextMessage: async (input, context) => { /* See next step */ },
}),
Session.init() // initializes session features
]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment