> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openbridge.shop/llms.txt
> Use this file to discover all available pages before exploring further.

# .logout()

> Log out the current customer

```javascript theme={null}
openbridge.customer.logout()
```

Logs out the current customer by invalidating the access token on Shopify's servers and clearing the local token storage.

## Returns

`Promise<void>`

## Examples

### Basic logout

```javascript theme={null}
await openbridge.customer.logout()
console.log('Logged out successfully')
window.location.href = '/'
```

### Logout button handler

```javascript theme={null}
document.querySelector('#logout-btn').addEventListener('click', async () => {
    await openbridge.customer.logout()

    // UI will update automatically if using subscribe()
    window.location.reload()
})
```

### With confirmation

```javascript theme={null}
async function handleLogout() {
    if (confirm('Are you sure you want to log out?')) {
        await openbridge.customer.logout()
        showToast('You have been logged out')
        redirectToHome()
    }
}
```

<Info>
  Logout triggers all subscribers with `null`, so your UI can automatically update to show the logged-out state.
</Info>
