Login

Android

Login to Versus services.

/**
* Login to Versus services.
*
* @property email The E-Mail Address associated with the users Versus account
* @property password The password associated with the users Versus Account
* @return Versus Account.Details on success or any errors encountered along the way.
*/
fun login(email: String, password: String): VsLiveData<Account.Details>
val email: String = "[email protected]"
val password: String = "password"

VersusDebugStateMachine.SDK.Account.login(email, password)
  .observe(object : VsObserver<Account.Details>() {
    override fun onError(error: Throwable) {}

    override fun onChanged(t: Account.Details) {}
})

Automatically login to Versus services if an account token has been stored from a previous login.

/**
* @return Versus Account.Details on success or any errors encountered along the way.
*/
fun login(): VsLiveData<Account.Details>
VersusDebugStateMachine.SDK.Account.login()
  .observe(object : VsObserver<Account.Details>() {
    override fun onError(error: Throwable) {}

    override fun onChanged(t: Account.Details) {}
})

iOS

Login to Versus Services. Note: If the email and password and not filled in, we will attempt to log the user in using a stored/cached authToken. If this fails, please acquire username / password.

/// - Parameters:
///     - email: The game Id associated with your game.
///     - password: This should be a unique id associated with a players' device.
///     - completionHandler: Closure which returns a Versus Session (or Error)
signIn(email: String?, password: String?, completionHandler: @escaping VersusApiResponse<VersusSession>)
VersusSDK?.signIn(email: email, password: password, completionHandler: { (session, error) in
    if error != nil {
        // error occurred
    } else {
        // Successfully signed in — the `session` returned corresponds to user’s active Winfinite session.

    }
})