Skip to main content

Logout

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

Steps to logout User

  1. Create a LogoutRequest object using LogoutRequest.Builder class by passing all the required parameters.
  2. Call logout() function using the instance of LMFeedClient.
  3. Process the response (LMResponse<Nothing>) as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of LogoutRequest
val logoutRequest = LogoutRequest.Builder()
.refreshToken("ENTER REFRESH TOKEN") // refresh token of the user
.deviceId("ENTER DEVICE ID") // unique id of the device
.build()
// get response (LMResponse<Nothing>)
val response = LMFeedClient.getInstance().logout(logoutRequest)
if (response.success) {
// process user logged out
processUserLoggedOut()
} else {
// your function to process error message
processError(response.errorMessage)
}
}

Models

LogoutRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
refreshTokenStringRefresh token of the user.
deviceIdStringUnique id of the device.