Skip to main content

Initiate User

To start using the LikeMinds Feed and enable personalized experiences for your users, you need to initiate them within the system. This process associates a user in your application with a user in the LikeMinds Feed, allowing for seamless integration and personalized recommendations.

Steps to initiate User

  1. Create a InitiateUserRequest object using InitiateUserRequest.Builder class by passing all the required parameters.
  2. Call initiateUser() function using the instance of LMFeedClient.
  3. Process the response LMResponse<InitiateUserResponse> as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of InitiateUserRequest
val initiateUserRequest = InitiateUserRequest.Builder()
.apiKey("ENTER API KEY") // api key of the community
.deviceId("ENTER DEVICE ID") // unique id of the device
.uuid("ENTER UUID") // client side user unique Id
.userName("ENTER USER NAME") // name of the user
.isGuest(false) // user is a guest or not
.build()
// get response (LMResponse<InitiateUserResponse>)
val response = LMFeedClient.getInstance().initiateUser(initiateUserRequest)
if (response.success) {
// your function to process the response data
processInitiateUserResponse(response.data)
} else {
// your function to process error message
processError(response.errorMessage)
}
}

Models

InitiateUserRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
apiKeyStringApi key of the community.
deviceIdStringUnique id of the device.
userNameStringName of the user.
uuidStringClient side user unique id.
isGuestBooleantrue if user is a guest, false otherwise.

InitiateUserResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
accessTokenStringAccess token of the user.
refreshTokenStringRefresh token of the user.
userUserObject of the user initiated.
communityCommunityObject of the community.
appAccessBooleanObject of the user initiated.
logoutResponseLMResponse<Nothing>Logout response in case the user doesn't have the access.