Skip to main content

If you are using our backend SDK that is lesser than the following versions, please visit the older documentation link here.

Doing operations post a password reset

To perform any task like analytics, sending a user an email, notifying an internal dashboard, post resetting a password, you'll need to override the passwordResetPOST API.

import SuperTokens from "supertokens-node";
import EmailPassword from "supertokens-node/recipe/emailpassword";
import Session from "supertokens-node/recipe/session";

SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
recipeList: [
EmailPassword.init({
override: {
apis: (originalImplementation) => {
return {
...originalImplementation,
passwordResetPOST: async function(input) {

if (originalImplementation.passwordResetPOST === undefined) {
throw Error("Should never come here");
}

// First we call the original implementation
let response = await originalImplementation.passwordResetPOST(input);

// Then we check if it was successfully completed
if (response.status === "OK") {
// TODO: post password reset logic
}
return response;
}
};
},
},
}),
Session.init()
]
});
Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI