Skip to main content

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 ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";import Session from "supertokens-node/recipe/session";
SuperTokens.init({    appInfo: {        apiDomain: "...",        appName: "...",        websiteDomain: "..."    },    recipeList: [        ThirdPartyEmailPassword.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()    ]});
What type of UI do you want to use?
Custom UI
Pre built UI