Skip to main content

How to use

Use the override config#

import SuperTokens from "supertokens-auth-react";
import ThirdPartyEmailPassword from "supertokens-auth-react/recipe/thirdpartyemailpassword";

SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
recipeList: [
ThirdPartyEmailPassword.init({
override: {
functions: (originalImplementation) => {
return {
...originalImplementation,

// we will only be overriding what happens when a user
// clicks the sign in or sign up button.
thirdPartySignInAndUp: async function (input) {
// TODO: some custom logic

// or call the default behaviour as show below
return originalImplementation.thirdPartySignInAndUp(input);
},
// ...
// TODO: override more functions
}
}
}
})
]
});
  • originalImplementation is an object that contains functions that have the original implementation for this recipe. They can be used in your functions as a way to use the SuperTokens' default behaviour.
  • In the above code snippet, we override the signInAndUp function of this recipe. This means that when the user clicks the sign in or sign up button in the UI, your function will be called with the relevant input object.
Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI