Add User
Once a user has logged in to the application, then they can add a new user as a family login. Family login is a functionality that allows multiple users to log in to a single application. The Add User flow involves a set of events described in the add user events list. To start the flow, the user needs to trigger AddUserWithTokenEvent.
AddUser event flow-diagram
This diagram shows the add user with token flow.
iOS/Swift
Below is the code snippet for Swift to trigger the add user with token process:
private func performAddUser(user: KsUserIdentifier, token: String) {
let addUserEvent = KSMAddUserWithTokenEvent(userIdentifier: user, token: token, enableAutoLogin: true)
let timer = CallTimer(event: addUserEvent)
MasterControllerAdapter.sharedInstance.sendEvent2MasterController(event: addUserEvent) { [weak self] resultEvent in
self?.handleAddUserEvent(resultEvent: resultEvent, timer: timer)
}
}
Android/Kotlin
In Kotlin, you can use the code snippet below to trigger AddUserWithTokenEvent:
fun triggerAddUserWithTokenEvent(
userIdentifier: UserIdentifier,
token: String,
autoLogin: Boolean
) {
val addUserWithTokenEvent = AddUserWithTokenEvent(userIdentifier, token, autoLogin)
synchronousEventHandler.postEvent(addUserWithTokenEvent)?.then {
// handle result
}
}
All platforms
As response of this event, Master Controller provides AddUserResultEvent, or a LoginResultEvent if you used autoLogin=true when triggering AddUserWithTokenEvent. Overall the flow is similar to the activation with token flow. You can find the possible status codes of AddUserResultEvent here.