UserManager

interface UserManager : SupportUserManager

Manages user authentication. Provides methods for login, logout, change password and the logged-in/out

Types

Status
Link copied to clipboard
sealed class Status

Base class for the possible statuses of the SmartSpacesSdk

Functions

changePassword
Link copied to clipboard
abstract suspend fun changePassword(currentPassword: String, newPassword: String): Result<Unit>

Change the user password.

abstract fun changePassword(currentPassword: String, newPassword: String, callback: (Result<Unit>) -> Unit): Cancelable
abstract fun changePassword(currentPassword: String, newPassword: String, lifecycleOwner: LifecycleOwner, callback: (Result<Unit>) -> Unit): Cancelable

Support function to change the user password.

externalTokenLogin
Link copied to clipboard
abstract suspend fun externalTokenLogin(authenticationToken: String): Result<Unit>

Login the user using server-to-server pre-shared authentication token. This is used when the host app backend registers a token for that user on the Smart Workspaces backend.

abstract fun externalTokenLogin(authenticationToken: String, callback: (Result<Unit>) -> Unit): Cancelable
abstract fun externalTokenLogin(authenticationToken: String, lifecycleOwner: LifecycleOwner, callback: (Result<Unit>) -> Unit): Cancelable

Support function to login the user using server-to-server pre-shared authentication token.

getStatusLiveData
Link copied to clipboard
abstract fun getStatusLiveData(): LiveData<UserManager.Status>

Get observable status of the SDK. The Status is a Kotlin sealed class. That means they might contain extra parameters inside such as server messages, or error codes.

getUserLiveData
Link copied to clipboard
abstract fun getUserLiveData(): LiveData<SimpleResponse<User>?>

Get a LiveData of the logged-in user. This includes name, email, etc.

logout
Link copied to clipboard
abstract fun logout()

Logs out the user. The status will immediately change to Status.LoggingOut This process might take a couple of seconds to complete and then the status will change to Status.Initializing

oAuthLogin
Link copied to clipboard
abstract suspend fun oAuthLogin(redirectedUri: String): Result<Unit>

Login the user using OAuth2. This usually happens after a Chrome Custom tab was shown and the user successfully authenticated with the oauth2 provider.

abstract fun oAuthLogin(redirectedUri: String, callback: (Result<Unit>) -> Unit): Cancelable
abstract fun oAuthLogin(redirectedUri: String, lifecycleOwner: LifecycleOwner, callback: (Result<Unit>) -> Unit): Cancelable

Support function to login the user using OAuth2-

usernamePasswordLogin
Link copied to clipboard
abstract suspend fun usernamePasswordLogin(username: String, password: String): Result<Unit>

Login the user with direct username (usually a username or email) and password.

abstract fun usernamePasswordLogin(username: String, password: String, callback: (Result<Unit>) -> Unit): Cancelable
abstract fun usernamePasswordLogin(username: String, password: String, lifecycleOwner: LifecycleOwner, callback: (Result<Unit>) -> Unit): Cancelable

Support function to login the user with direct username (usually a username or email) and password.