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
- Create a LogoutRequest object using
LogoutRequest.Builder
class by passing all the required parameters. - Call
logout()
function using the instance ofLMFeedClient
. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
refreshToken | String | Refresh token of the user. | |
deviceId | String | Unique id of the device. |