📍 Bolt Help / Core Products / Accounts / Direct API / Call Logout Method (Optional)
Call Logout Method (Optional)
Implement a method dedicated to shopper logout (for Accounts Direct API).

Calling the Logout Method from your front end:

  1. logs shoppers out of their Bolt Account from your storefront UI, and
  2. clears any logged in Bolt Account sessions across multiple sites on the browser.

INFO

This method does not replace the Login Status component. It instead gives merchants and platforms the ability to logout the shopper from their Bolt account via a frontend API. This API will allow the developer to interact with a Bolt iframe, responsible for clearing Bolt logged in sessions.

Shopper Experience

The shopper’s experience is what the merchant chooses it to be. Regardless, activation of this component will result in the shopper being logged out of their Bolt account on that store, as well as any other logged in Bolt Account sessions.

Step 1: Create the Logout Component

Ensure you have called the boltEmbedded component package anywhere you call the Logout Component, as well as the asynchronous logout helper (helpers.logout();).

const boltEmbedded = Bolt(boltPublishableKey);

Step 2: Call the Logout Function

Wherever you wish to call the Logout method, call the logout() function.

NOTE

Bolt’s logout is a void function – a Bolt iframe works in the background to log the shopper out of their Bolt account.

await boltEmbedded.helpers.logout();
function logout(): Promise<void>;

Step 3: Complete Logout Functionality

When the platform logout button is clicked, your platform should:

  1. Forget any OAuth tokens associated with the shopper.
  2. Call BoltEmbedded.Utilities.Logout() to log the shopper out of their Bolt session.
  3. Logout the Shopper from the store’s native experience.
Filter by Section
Filter by Topic