> For the complete documentation index, see [llms.txt](/llms.txt).

# logout

Function to disconnect from Web3Auth.

### Usage[​](#usage "Direct link to Usage")

```
function LogoutButton() {
  const handleLogout = async () => {
    try {
      await web3auth.logout()
      console.log('Logged out successfully')
    } catch (error) {
      console.error('Error logging out:', error)
    }
  }

  return <button onClick={handleLogout}>Logout</button>
}

```

### Function signature[​](#function-signature "Direct link to Function signature")

```
logout(options?: { cleanup: boolean }): Promise<void>;

```

#### Parameters[​](#parameters "Direct link to Parameters")

- **options** (optional)
- **cleanup** (`boolean`): Whether to remove all user data during logout.

#### Return value[​](#return-value "Direct link to Return value")

Promise that resolves when the user is successfully logged out.
