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
- Create an object of the
LogoutRequest
class. - Call the
logout()
function using the instance of theLMChatClient
class. - 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
Variable | Type | Description | Optional |
---|---|---|---|
refreshToken | String? | The refresh token for the user session | ✔️ |
deviceId | String? | The device ID from which the user is logging out | ✔️ |