Skip to main content
import { useStytchB2BClient } from '@stytch/react/b2b';

export const LogOutButton = () => {
  const stytch = useStytchB2BClient();

  const logout = () => {
    stytch.session.revoke();
  };

  return <button onClick={logout}>Log out</button>;
};
Wraps the Revoke Session endpoint. Use this method to log the current member out. When this method is called, we clear the member and session objects from the cache unless the SDK cannot contact the Stytch servers. This behavior can be overridden by using the optional param object.

Parameters

options
object
An object containing optional parameters for revoking the session.

Response

status_code
number
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
request_id
string
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.