B2BSessions

interface B2BSessions

The B2BSessions interface provides methods for authenticating, updating, or revoking sessions, and properties to retrieve the existing session token (opaque or JWT).

Types

Link copied to clipboard
data class AuthParams @JvmOverloads constructor(val sessionDurationMinutes: Int? = null)

Data class used for wrapping parameters used with Sessions authentication

Link copied to clipboard
data class ExchangeParameters @JvmOverloads constructor(val organizationId: String, val sessionDurationMinutes: Int, val locale: Locale? = null)

Data class used for wrapping parameters used with Sessions exchange

Link copied to clipboard
data class RevokeParams @JvmOverloads constructor(val forceClear: Boolean = false)

Data class used for wrapping parameters used with Sessions revocation

Properties

Link copied to clipboard
abstract val onChange: StateFlow<B2BSessionData?>

Exposes a flow of session data

Link copied to clipboard
abstract val sessionJwt: String?
Link copied to clipboard
abstract val sessionToken: String?

Functions

Link copied to clipboard
abstract fun authenticate(authParams: B2BSessions.AuthParams, callback: (SessionsAuthenticateResponse) -> Unit)

Authenticates a Session and updates its lifetime by the specified session_duration_minutes. If the session_duration_minutes is not specified, a Session will not be extended

Link copied to clipboard

Authenticates a Session and updates its lifetime by the specified session_duration_minutes. If the session_duration_minutes is not specified, a Session will not be extended

Link copied to clipboard
abstract fun exchange(parameters: B2BSessions.ExchangeParameters, callback: (SessionExchangeResponse) -> Unit)

Exchanges an existing session for one in a different organization

Link copied to clipboard

Exchanges an existing session for one in a different organization

Link copied to clipboard
abstract fun getSync(): B2BSessionData?

Get session from memory without network call

Link copied to clipboard
abstract fun onChange(callback: (B2BSessionData?) -> Unit)

Assign a callback that will be called when the session data changes

Link copied to clipboard
abstract suspend fun revoke(params: B2BSessions.RevokeParams = RevokeParams()): BaseResponse
abstract fun revoke(params: B2BSessions.RevokeParams = RevokeParams(), callback: (BaseResponse) -> Unit)

Revoke a Session and immediately invalidate all its tokens.

Link copied to clipboard

Revoke a Session and immediately invalidate all its tokens.

Link copied to clipboard
abstract fun updateSession(sessionToken: String, sessionJwt: String)

Updates the current session with a sessionToken and sessionJwt