Skip to main content

Sample apps

Each platform has a sample app that shows a complete integration: initialization, SSO, navigation, theming and more. Run it with your own API key to see the community working before you integrate it in your app.

Before you begin​

  • An API key for a sandbox community. Request one from the form on octopuscommunity.com.
  • To sign users in with SSO, a way to get a user token: either your community's token secret, used by some samples to sign a JWT locally, or a JWT from your backend. See Generate a signed JWT.
  • The toolchain of your platform: see Requirements.
danger

Some samples sign the SSO JWT inside the app with your community's token secret, only to make the demo self-contained. Never put this secret in an app you ship: anyone could extract it and sign in as any user. In your app, the JWT always comes from your backend.

Which sample shows what​

PlatformRepositoryWhat it covers
Androidoctopus-sdk-androidOne build variant per navigation pattern, plus theming, SSO, bridges and push notifications.
iOSoctopus-sdk-swiftModal and tab integrations, SSO in the Account tab, and scenarios such as theming, bridges and events in the More tab.
Flutteroctopus-sdk-flutterThe example app, with SSO and the reactive APIs.
React Nativeoctopus-sdk-react-nativeThe example app, whose Scenarios tab walks through most of the reactive and analytics APIs.
Unityoctopus-sdk-unityThe UnityExample project, and importable samples for Octopus authentication, push notifications and groups.

Run the sample​

The samples module has one build variant per navigation pattern: singleactivity, fullscreen, bottomnavigationbar, nestednavigation, contentpadding and modalbottomsheet. It needs JDK 17 and an Android SDK, or Android Studio.

  1. Clone the repository and add your API key to local.properties at its root:

    git clone https://github.com/Octopus-Community/octopus-sdk-android.git && cd octopus-sdk-android
    echo "OCTOPUS_API_KEY=YOUR_API_KEY" >> local.properties
  2. To sign users in with SSO, also add your community's token secret. The sample uses it to sign the JWT locally:

    OCTOPUS_SSO_CLIENT_USER_TOKEN_SECRET=YOUR_TOKEN_SECRET
  3. Install the variant that matches your navigation, for example:

    ./gradlew :samples:installFullscreenDebug

Each variant's entry point is samples/src/<variant>/java/com/octopuscommunity/sample/screens/MainScreen.kt.

Next steps​