signIn

abstract suspend fun signIn(login: String, password: String, host: String? = null): RainbowResult<Unit>

Initiates a sign-in process using the provided login credentials and an optional custom host URL.

Return

RainbowResult to receive callbacks for sign-in events.

Parameters

login

The user's login credentials.

password

The user's password for authentication.

host

Optional custom host URL for authentication. Set to null for default configuration.

Samples

import android.net.Uri
import com.ale.infra.rest.authentication.AuthenticationUrl
import com.ale.infra.rest.listeners.onFailure
import com.ale.infra.rest.listeners.onSuccess
import com.ale.rainbowsdk.Connection
import com.ale.rainbowsdk.RainbowSdk
import com.ale.security.util.HttpAuthorizationUtil
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

fun main() { 
   //sampleStart 
   if (RainbowSdk().connection().state != Connection.ConnectionState.DISCONNECTED) {
    // User is already authenticating or authenticated
    return
}

val sandboxHost = "sandbox.openrainbow.com"

CoroutineScope(Dispatchers.Main).launch {
    // This is a standard connection using a login and password
    RainbowSdk().connection().signIn(
        login = login,
        password = password,
        host = sandboxHost
    ).onSuccess {
        // Your code to navigate from login screen to home screen
    }.onFailure { error ->
        // Use error code to display a useful message to the user
    }
} 
   //sampleEnd
}

abstract suspend fun signIn(login: String, password: String): RainbowResult<Unit>

Initiates a sign-in process using the provided login credentials.

Return

RainbowResult to receive callbacks for sign-in events.

Parameters

login

The user's login credentials.

password

The user's password for authentication.