Skip to main content

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​

  1. Build a LogoutRequest object using the LogoutRequestBuilder class.

  2. Call the logout() function using the instance of the LMFeedClient class.

  3. 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

VariableTypeDescriptionOptional
refreshTokenStringRefresh token for authentication✔
deviceIdStringUnique identifier for the device✔

LogoutResponse​

List of parameters for the LogoutResponse class

VariableTypeDescriptionOptional
successboolAPI success status
errorMessageStringError message in case of failure✔