Skip to main content

How to use

If you would like to change something pre or post our API logic, then use this method.

import SuperTokens from "supertokens-node";
import ThirdParty from "supertokens-node/recipe/thirdparty";

SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdParty.init({
signInAndUpFeature: {
providers: [/* ... */]
},
override: {
apis: (originalImplementation) => {
return {
...originalImplementation,

// here we only override the sign in / up API logic
signInUpPOST: async function (input) {

if (originalImplementation.signInUpPOST === undefined) {
throw Error('Should never come here')
}

// TODO: some custom logic

// or call the default behaviour as show below
return await originalImplementation.signInUpPOST(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 signInUpPOST api of this recipe. This api will be used to handle the signInUp API route when a user either signs up or signs in.
Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI