Skip to main content

Redirect To Auth Screen

Use the redirectToAuth({show?: "signin" | "signup", redirectBack?: boolean}?) function to redirect the user to the full page auth screen provided by SuperTokens.

import { redirectToAuth } from "supertokens-auth-react/recipe/emailpassword";
function NavBar () {  async function onLogin () {    redirectToAuth();   }  return (    <ul>        <li>Home</li>        <li onClick={onLogin}>Login</li> 
    </ul>  )}
  • Call redirectToAuth({show: "signin"}) to take them to the sign in screen
  • Call redirectToAuth({show: "signup"}) to take them to the sign up screen
  • If you want the user to be redirected to the current page post sign in, use redirectToAuth({redirectBack: true})