Skip to main content

Handle Event Hook

This function is called for various user actions. It can be used for logging, analytics or any side effect purposes (these are essentially fire and forget events).

import ThirdPartyPasswordless from "supertokens-auth-react/recipe/thirdpartypasswordless";

ThirdPartyPasswordless.init({
contactMethod: "EMAIL", // This example will work with any contactMethod
onHandleEvent: (context) => {
if (context.action === "SESSION_ALREADY_EXISTS") {
// TODO:
} else if (context.action === "PASSWORDLESS_RESTART_FLOW") {
// TODO:
} else if (context.action === "PASSWORDLESS_CODE_SENT") {
// TODO:
} else if (context.action === "SUCCESS") {
const user = context.user;
if (context.isNewUser) {
// TODO: Sign up
} else {
// TODO: Sign in
}
}
},
})
info
Which UI do you use?
Custom UI
Pre built UI