Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.prelude.so/llms.txt

Use this file to discover all available pages before exploring further.

This guide covers how to use the Prelude mobile SDKs to authenticate users on iOS, Android, Flutter, and React Native. The mobile SDKs persist tokens in the platform’s secure store and bind them to the device with DPoP. Pick your platform once: tabs across this section stay in sync.

Prerequisites

Before you start, make sure you have:
  • Xcode 15 or later, targeting iOS 15 or later
A custom domain is optional on iOS. The SDK is reachable at the per-application Prelude subdomain (https://{app_id}.session.prelude.dev).

Install the SDK

Add the Prelude Apple SDK to your Xcode project as a Swift Package dependency:
https://github.com/prelude-so/apple-sdk
In Package.swift:
dependencies: [
    .package(url: "https://github.com/prelude-so/apple-sdk", from: "0.2.0"),
],
targets: [
    .target(
        name: "YourApp",
        dependencies: [
            .product(name: "PreludeSession", package: "apple-sdk"),
        ]
    ),
]

Initialize the SDK

Create a session client pointing at your application’s domain.
import PreludeSession

let client = try PreludeSessionClient(
    endpoint: .custom("https://{app_id}.session.prelude.dev")
)
PreludeSessionClient is a Sendable value type — copies share a single underlying actor, so it’s safe to pass through @State, @Environment, or task groups.
Create a new SwiftUI app in Xcode, add the PreludeSession package above, then replace ContentView.swift with:
ContentView.swift
import SwiftUI
import PreludeSession

// Replace with your application id.
private let appID = "YOUR_APP_ID"

@MainActor
final class SessionStore: ObservableObject {
    let client: PreludeSessionClient

    init() {
        self.client = try! PreludeSessionClient(
            endpoint: .custom("https://\(appID).session.prelude.dev")
        )
    }
}

struct ContentView: View {
    @StateObject private var store = SessionStore()

    var body: some View {
        VStack(spacing: 12) {
            Text("Session Test").font(.title)
            Text("SDK initialized.")
        }
        .padding()
    }
}
Build and run on the iOS simulator. If the SDK initialized cleanly, you’re ready to wire up a login flow.

Helpers

No additional helpers are required — the iOS examples on subsequent pages can be used as-is.