The Solibo SDK is available for multiple platforms. Follow the instructions below to get started with your preferred platform.
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.
The SDK provides a core JS/TS package and an optional React Query integration package.
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
To start using the SDK, you need to configure the HomeApi User Pool ID from Cognito, and the auth scheme you wish to use.
The easiest way to configure the SDK in Kotlin is using the specialized factory methods in SoliboSDK.create.
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) andPushTokenProvider(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
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
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>
)
}
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
fingerprinterfor Cognito Advanced Security and arefreshFailureHandler. 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>
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>
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.