Skip to main content
Version: Next

Logging in and out Vipaso Customer and Business users

This guide shows how to implement login/logout flows for both Customer and Business users using the Android SDK.

Prerequisites

Customer — Login

Authenticate a customer user with identifier (email or phone) and password. The SDK securely stores the session.

import io.vipaso.vipaso.sdkApi.user.common.LoginRequest

val request = LoginRequest(
userIdentifer = "user@example.com",
password = "secure_password"
)

try {
Vipaso.user.customer.login(request)
// Success: user can now access Customer features
} catch (e: Throwable) {
// Handle authentication error
}

Customer — Logout

Vipaso.user.customer.logout()

Customer — Authentication State

Observe whether the customer is authenticated.

Vipaso.user.customer.isAuthenticated()
.collect { authenticated ->
if (authenticated) {
// Show main app content
} else {
// User is not logged in, show login screen
}
}

Business — Login

Authenticate a business user with identifier and password.

import io.vipaso.vipaso.sdkApi.user.common.LoginRequest

val request = LoginRequest(
userIdentifer = "merchant@example.com",
password = "secure_password"
)

try {
Vipaso.user.business.login(request)
// Success: user can now access Business features
} catch (e: Throwable) {
// Handle authentication error
}

Business — Logout

Vipaso.user.business.logout()

Business — Authentication State

Vipaso.user.business.isAuthenticated()
.collect { authenticated ->
if (authenticated) {
// Show main app content
} else {
// User is not logged in, show login screen
}
}