<Routes>
{/* This shows the login UI on "/auth" route */}
{getSuperTokensRoutesForReactRouterDom(require("react-router-dom"))}
<Route
path="/"
element={
/* This protects the "/" route so that it shows
<Home /> only if the user is logged in.
Else it redirects the user to "/auth" */
<SessionAuth
onSessionExpired={() => {
updateShowSessionExpiredPopup(true);
}}>
<Home />
{showSessionExpiredPopup && <SessionExpiredPopup />}
</SessionAuth>
}
/>
</Routes>
SuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).