Sign out
- ReactJS
- Plain JavaScript
- React Native
The signOut
method revokes the session on the frontend and backend.
import React from "react";import { signOut } from "supertokens-auth-react/recipe/passwordless";
function NavBar() { async function onLogout() { await signOut(); window.location.href = "/"; } return ( <ul> <li>Home</li> <li onClick={onLogout}>Logout</li>
</ul> )}
- Via NPM
- Via Script Tag
The signOut
method revokes the session for the user.
import SuperTokens from "supertokens-website";
async function logout () { await SuperTokens.signOut(); window.location.href = "/";}
The signOut
method revokes the session for the user.
async function logout() { await supertokens.signOut(); window.location.href = "/";}
The signOut
method revokes the session for the user.
import SuperTokens from "supertokens-react-native";
async function logout () { await SuperTokens.signOut(); // redirect the user to the login screen}
- We do not provide any UI for a Sign-out button
- On success, the
signOut
function does not redirect the user to another page.