Skip to main content

logoutCustomer()

logoutCustomer(): Promise<Success>

Logs the current customer out.

Returns​

Promise<Success>

Promise that resolves to a success result.

Remark​

Removes the stored token right away, so getCurrentRole returns null. The next Growave request gets a new guest token, so you don't need to reload the page. An authenticateCustomer() request that is still in flight is discarded.

On a standard Online Store, Shopify owns the customer session: the next request authenticates the customer again through App Proxy. Log the customer out of Shopify instead.

Example​

window.gw.sdk.runIfModuleReady(
window.gw.sdk.common.constants.modules.AUTHENTICATION,
() => {
window.gw.sdk.authentication.methods.logoutCustomer();
}
);