solibo-sdk

Getting Started

The Solibo SDK is available for multiple platforms. Follow the instructions below to get started with your preferred platform.

Native Mobile (Android/iOS) & JVM

Add the Maven Central repository and implementation dependency to your build.gradle.kts:

repositories {
    mavenCentral()
}

dependencies {
    implementation("no.solibo.oss:sdk:1.5.12") // Check for the latest version
}

For more complex setups, such as using the SDK in a multi-module KMP project, refer to our advanced setup guide.

Web (JS/TS/React)

The SDK provides a core JS/TS package and an optional React Query integration package.

Core SDK Only

npm install @solibo/solibo-sdk

Install the SDK and React Query hooks using your package manager:

npm install @solibo/solibo-sdk @solibo/solibo-query @tanstack/react-query

Basic Configuration

To start using the SDK, you need to configure the HomeApi User Pool ID from Cognito, and the auth scheme you wish to use.

Kotlin (Android/iOS/JVM)

The easiest way to configure the SDK in Kotlin is using the specialized factory methods in SoliboSDK.create.

Mobile (Android/iOS)

Uses token-based authentication and device management for push notifications.

For production applications, you should provide platform-specific implementations for Fingerprinter (for Cognito Advanced Security) and PushTokenProvider (for push notifications). See the advanced setup guide for examples.

import no.solibo.oss.sdk.SoliboSDK

val sdk = SoliboSDK.createMobile(
    userPoolId = "jTVySlcSZ",
    clientId = "1rhb7bjvmthh4qikac32933s7c"
)
// sdk.api.setInitialBaseUrl("https://api.home.solibo.no") // Optional, default is https://api.home.solibo.no

Machine-to-Machine

Uses Client Credentials flow with a client secret.

val sdk = SoliboSDK.createM2M(
    clientId = "YOUR_CLIENT_ID",
    clientSecret = "YOUR_CLIENT_SECRET",
    scopes = listOf("read", "write")
)
// sdk.api.setInitialBaseUrl("https://api.home.solibo.no") // Optional, default is https://api.home.solibo.no

React (TypeScript)

Wrap your application in the SoliboProvider. Depending on your environment (Browser or Mobile app), you can use the built-in configuration helpers.

For web applications running in a browser, use the COOKIE configuration. This will use HTTP-only cookies for session management.

import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { SoliboProvider } from '@solibo/solibo-query'

const qc = new QueryClient()
const config = {
    domain: 'home.solibo.no', // Optional, default is api.home.solibo.no
    authMode: 'COOKIE',
    cognitoUserPoolId: '...',
    clientId: '...'
};

function App() {
  return (
    <QueryClientProvider client={qc}>
      <SoliboProvider config={config}>
        <YourAppContent />
      </SoliboProvider>
    </QueryClientProvider>
  )
}

Mobile (Android/iOS) & Node.js

For mobile applications (Android/iOS via Capacitor or React Native) or Node.js scripts, use token-based authentication. This mode uses access and refresh tokens instead of browser cookies.

For native Android or iOS development, we recommend using our Kotlin SDK for the best performance and platform-native experience.

Production apps should also implement a fingerprinter for Cognito Advanced Security and a refreshFailureHandler. See the React setup example for details.

const config = {
    domain: 'api.home.solibo.no', // Optional, default is api.home.solibo.no
    authMode: 'TOKEN',
    cognitoUserPoolId: '...',
    clientId: '...'
};

<SoliboProvider config={config}>
  <YourAppContent />
</SoliboProvider>

Machine-to-Machine (M2M)

For server-side integrations or background tasks that use client credentials.

const config = {
    domain: 'api.home.solibo.no', // Optional, default is api.home.solibo.no
    authMode: 'M2M',
    clientId: 'YOUR_CLIENT_ID',
    clientSecret: 'YOUR_CLIENT_SECRET',
    scopes: ['read', 'write']
};

<SoliboProvider config={config}>
  <YourAppContent />
</SoliboProvider>

Real-time Events (EventBus)

The SDK includes a built-in EventBus for receiving real-time updates and sending commands over WebSockets. It is lazily initialized, meaning the connection is only established when you first access the eventBus property on your SDK instance.

For a detailed guide and platform-specific examples, see the Event Bus documentation.

For more practical examples and platform-specific setups, see our Usage Examples.