Which UI do you use?
Custom UI
Pre built UI
Embed our pre built UI component
#
Case 1: Rendering the TOTP Widget in a pageThe following example shows the scenario where you have a dedicated route, such as /totp
, for rendering the TOTP Widget. Upon a successful login, the user will be automatically redirected to the return value of getRedirectionURL
(defaulting to /
).
- ReactJS
- Angular
- Vue
Important
SuperTokens does not provide non-React UI components. So we will be using the
supertokens-auth-react
SDK and will inject the React components to show the UI. Therefore, the code snippet below refers to the supertokens-auth-react
SDK.Do you use react-router-dom?
YesNo
Important
SuperTokens does not provide non-React UI components. So we will be using the
supertokens-auth-react
SDK and will inject the React components to show the UI. Therefore, the code snippet below refers to the supertokens-auth-react
SDK.Do you use react-router-dom?
YesNo
Do you use react-router-dom?
YesNo
In the above code snippet, we:
- Disabled the default TOTP UI by setting
disableDefaultUI
totrue
inside the TOTP recipe config. - Overrode the
getRedirectionURL
function inside the MFA recipe config to redirect to/totp
whenever we want to show the TOTP factor.
Feel free to customize the redirection URLs as needed.
#
Case 2: Rendering the TOTP Widget in a popupThe following example shows the scenario where you embed the TOTP Widget in a popup, and upon successful login, you aim to close the popup. This is especially useful for step up auth.
- ReactJS
- Angular
- Vue
Important
SuperTokens does not provide non-React UI components. So we will be using the
supertokens-auth-react
SDK and will inject the React components to show the UI. Therefore, the code snippet below refers to the supertokens-auth-react
SDK.Do you use react-router-dom?
YesNo
Important
SuperTokens does not provide non-React UI components. So we will be using the
supertokens-auth-react
SDK and will inject the React components to show the UI. Therefore, the code snippet below refers to the supertokens-auth-react
SDK.Do you use react-router-dom?
YesNo
Do you use react-router-dom?
YesNo