Logout User
To securely terminate a user session and log the user out of the LikeMinds Feed, use the logout() function.
Steps to Logout User
Build a
LogoutRequestobject using theLogoutRequestBuilderclass.Call the
logout()function using the instance of theLMFeedClientclass.Use the response as per your requirement.
// Provide refresh token and device ID for logging out the user
String? refreshToken = "refresh_token_here";
String? deviceId = "device_id_here";
// Build the request object
LogoutRequest request = (LogoutRequestBuilder()
..refreshToken(refreshToken)
..deviceId(deviceId))
.build();
// Get the response from calling the function
final LogoutResponse response = await lmFeedClient.logout(request);
// Process the response, as per requirement
if(response.success){
// your function to process user logout
processUserLogout(response);
}else{
// your function to process error message
processError(response.errorMessage);
}
tip
Logging out a user ensures the termination of the current session and provides a secure user experience.
Models
LogoutRequest
List of parameters for the LogoutRequest class
| Variable | Type | Description | Optional |
|---|---|---|---|
| refreshToken | String | Refresh token for authentication | ✔ |
| deviceId | String | Unique identifier for the device | ✔ |
LogoutResponse
List of parameters for the LogoutResponse class
| Variable | Type | Description | Optional |
|---|---|---|---|
| success | bool | API success status | |
| errorMessage | String | Error message in case of failure | ✔ |