Skip to main content

Logout User

To disconnect a user (say that you’re for instance logging out and logging in as someone new) you can call the logout() method present in LMChatClient class.

Steps to Logout​

  1. Create an object of the LogoutRequest class.
  2. Call the logout() function using the instance of the LMChatClient class.
  3. Process the response (LMResponse<void>) as per your requirement.
LogoutRequest request = (LogoutRequestBuilder()
..refreshToken("ENTER_REFRESH_TOKEN")
..deviceId("ENTER_DEVICE_ID"))
.build();

LMResponse<void> response = await lmChatClient.logout(request);

if (response.success) {
// your function to handle successful logout
handleLogoutSuccess();
} else {
// your function to handle logout error
handleLogoutError(response.errorMessage);
}

Models​

LogoutRequest​

List of parameters for the LogoutRequest class

VariableTypeDescriptionOptional
refreshTokenString?The refresh token for the user session✔️
deviceIdString?The device ID from which the user is logging out✔️