Skip to content

Logging users out

To log a user out, use the logout method from the usePrivy hook:

tsx
const {logout} = usePrivy();

Below is an example of a sample logout button for your app:

tsx
import {usePrivy} from '@privy-io/expo';

function LogoutButton() {
  const {logout} = usePrivy();
  return <Button onPress={() => logout()}>Log out</Button>;
}

TIP

You can run additional code after the user has been logged out by doing await logout(), as the method returns a promise.