Skip to main content

How to use

import SuperTokens from "supertokens-node";
import ThirdPartyPasswordless from "supertokens-node/recipe/thirdpartypasswordless";

appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
recipeList: [
contactMethod: "EMAIL", // This example will work with any contactMethod
flowType: "USER_INPUT_CODE_AND_MAGIC_LINK", // This example will work with any flow.
override: {
apis: (originalImplementation) => {
return {

// here we only override the API that is called when a user
// clicks on a magic link or enters an OTP
consumeCodePOST: async function (input) {
if (originalImplementation.consumeCodePOST === undefined) {
throw Error("Should never come here")

// TODO: some custom logic

// or call the default behaviour as show below
return await originalImplementation.consumeCodePOST(input);
// ...
// TODO: override more apis
  • originalImplementation is an object that contains apis that have the original implementation for this recipe. They can be used in your custom apis as a way to use the SuperTokens' default behaviour.
  • In the above code snippet, we override the consumeCodePOST api of this recipe. This api will be called when the user clicks on a magic link or enters an OTP.
Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI