Calling the Logout Method from your front end:
- logs shoppers out of their Bolt Account from your storefront UI, and
- 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>;
RECOMMENDED
We highly recommend reusing a Bolt embedded object if one has been created prior to this on the window for another Bolt embedded component. We advise against creating a new boltEmbedded
object.
Step 3: Complete Logout Functionality
When the platform logout button is clicked, your platform should:
- Forget any OAuth tokens associated with the shopper.
- Call
BoltEmbedded.Utilities.Logout()
to log the shopper out of their Bolt session. - Logout the Shopper from the store’s native experience.