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 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()    ]});
Which frontend SDK do you use?
supertokens-web-js / mobile
supertokens-auth-react