Kustomer.logout()

Logs a customer out and clears their session data.

πŸ‘

First, initialize chat fully

Kustomer Chat must finish initializing fully with Kustomer.start() before you can execute any additional Web SDK methods.

Tip: Call other methods inside the callback of Kustomer.start() to ensure Kustomer Chat always completes initialization before the code tries to run other methods.

To learn more, see Troubleshooting: Kustomer method calls won't execute.

Examples

// Logout a customer
Kustomer.logout();

// Logout a customer and run a callback after logout
Kustomer.logout((callbackResponse, error) => {
  if (error) {
    console.error(error);
  } else {
    console.log("Customer was logged out.");
  }
});

Did this page help you?