Skip to main content

Logout

Logs the user out by invalidating the session and clearing associated data. This method ensures the user's session is securely terminated.

Steps to Logout

  1. Call the logout() method using an instance of LMChatClient.
  2. Pass the LogoutRequest object containing the required details.
  3. Handle the response using the completion handler to check for success or errors.
let request = LogoutRequest.builder()
.refreshToken("YOUR_REFRESH_TOKEN")
.deviceId("YOUR_DEVICE_ID")
.build()

LMChatClient.shared.logout(request) { response in
switch response {
case .success:
print("User logged out successfully.")
case .failure(let error):
print("Logout failed: \(error.localizedDescription)")
default:
print("No response received")
}
}

Parameters

LogoutRequest

The LogoutRequest model encapsulates the necessary details to log the user out.

VARIABLETYPEDESCRIPTIONOPTIONAL
refreshTokenString?Refresh token for the user session✔️
deviceIdString?Unique identifier for the device✔️