Android API reference
Every export is fully typed. The signatures and props below come from the package's own reference documentation, so what is listed here is what the installed version ships.
Components
SignIn
component
The SignIn composable renders a full app-native sign-in form. It drives the Flow Execution API loop automatically: initiating the flow, presenting the server-defined inputs and actions on each step, and completing when the user is authenticated. SignIn requires ThunderIDProvider in its ancestor composable hierarchy.
Parameters
| Name | Type | Description |
|---|---|---|
| applicationId (required) | String | The Application ID from your Choreo Identity & Access Management application settings. Identifies which sign-in flow to execute. |
| modifier (optional) | Modifier | Compose modifier applied to the form container. |
| onComplete (optional) | (() -> Unit)? | Called when authentication completes successfully. |
| onError (optional) | ((String) -> Unit)? | Called with an error message when a flow step fails. |
import dev.thunderid.compose.components.presentation.auth.SignIn
@Composable
fun AuthView(applicationId: String) {
SignIn(
applicationId = applicationId,
modifier = Modifier.fillMaxWidth().padding(16.dp)
)
}
SignInButton
component
The SignInButton composable renders a pre-styled button that calls an onClick lambda when tapped. It does not initiate the sign-in flow itself. Your onClick handler opens the sign-in UI (e.g., showing a SignIn form or launching the redirect URL). SignInButton requires ThunderIDProvider in its ancestor composable hierarchy.
Parameters
| Name | Type | Description |
|---|---|---|
| onClick (required) | () -> Unit | Called when the button is tapped. |
| modifier (optional) | Modifier | Compose modifier. |
import dev.thunderid.compose.components.actions.SignInButton
@Composable
fun LandingView() {
var showSignIn by remember { mutableStateOf(false) }
SignInButton(onClick = { showSignIn = true })
if (showSignIn) {
SignIn(applicationId = "<your-application-id>")
}
}
SignOutButton
component
The SignOutButton composable renders a pre-styled button that calls ThunderIDClient.signOut(), then calls ThunderIDState.refresh() to update the reactive auth state. It disables itself automatically while the sign-out operation is in progress. SignOutButton requires ThunderIDProvider in its ancestor composable hierarchy.
Parameters
| Name | Type | Description |
|---|---|---|
| modifier (optional) | Modifier | Compose modifier applied to the button. |
| onSignOutComplete (optional) | (() -> Unit)? | Called after sign-out completes and ThunderIDState has been refreshed. |
import dev.thunderid.compose.components.actions.SignOutButton
@Composable
fun HomeView() {
Column {
Text("You are signed in.")
SignOutButton()
}
}
SignUp
component
The SignUp composable renders a full app-native registration form. It drives the Flow Execution API loop automatically: initiating the registration flow, presenting the server-defined inputs and actions on each step, and completing when the user is registered and authenticated. SignUp requires ThunderIDProvider in its ancestor composable hierarchy.
Parameters
| Name | Type | Description |
|---|---|---|
| modifier (optional) | Modifier | Compose modifier applied to the form container. |
| onComplete (optional) | (() -> Unit)? | Called when registration completes successfully. |
| onError (optional) | ((String) -> Unit)? | Called with an error message when a flow step fails. |
import dev.thunderid.compose.components.presentation.auth.SignUp
@Composable
fun RegisterView() {
SignUp(modifier = Modifier.fillMaxWidth().padding(16.dp))
}
SignedIn
component
The SignedIn composable conditionally renders its content only when the user is authenticated. It reads the current sign-in state from LocalThunderID and displays protected UI for signed-in users, while rendering optional fallback content (or nothing) when the user is not authenticated. SignedIn requires ThunderIDProvider in its ancestor composable hierarchy.
Parameters
| Name | Type | Description |
|---|---|---|
| fallback (optional) | (@Composable () -> Unit)? | The composable to render when the user is not authenticated. Defaults to nothing. |
| content (required) | @Composable () -> Unit | The composable to render when the user is authenticated. |
import dev.thunderid.compose.components.guards.SignedIn
@Composable
fun ContentView() {
SignedIn {
Text("You are signed in.")
}
}
SignedOut
component
The SignedOut composable conditionally renders its content only when the user is not authenticated. It is the counterpart to SignedIn. SignedOut requires ThunderIDProvider in its ancestor composable hierarchy.
Parameters
| Name | Type | Description |
|---|---|---|
| fallback (optional) | (@Composable () -> Unit)? | The composable to render when the user is authenticated. Defaults to nothing. |
| content (required) | @Composable () -> Unit | The composable to render when the user is not authenticated. |
import dev.thunderid.compose.components.guards.SignedOut
@Composable
fun ContentView() {
SignedOut {
Text("Please sign in to continue.")
}
}
UserProfile
component
The UserProfile composable renders an editable profile form. It loads the user's current profile from /scim2/Me when it first composes, presents editable fields for displayName and phoneNumbers, and saves changes via ThunderIDClient.updateUserProfile. UserProfile requires ThunderIDProvider in its ancestor composable hierarchy.
Parameters
| Name | Type | Description |
|---|---|---|
| modifier (optional) | Modifier | Compose modifier applied to the form container. |
| onSaved (optional) | (() -> Unit)? | Called after a successful profile save. |
| onError (optional) | (() -> Unit)? | Called when a load or save operation fails. |
import dev.thunderid.compose.components.presentation.user.UserProfile
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ProfileSheet(onDismiss: () -> Unit) {
ModalBottomSheet(onDismissRequest = onDismiss) {
UserProfile(
modifier = Modifier.fillMaxWidth().padding(24.dp),
onSaved = onDismiss
)
}
}
ChangeCredential
component
The ChangeCredential composable renders a form that lets a signed-in user set a new value for one of their own credentials. It collects only a new value and its confirmation, checks it against the applicable rules, and posts the change via ThunderIDClient.updateUserCredentials. It reads the rules it needs from the user type schema (GET /users/me/meta), fetched once and shared with any other mounted component that needs it (for example UserProfile), so multiple components cost one request rather than one each. The default label and messages are built from the credential attribute's own displayName in that schema, so they always match whatever an admin named it there. By default it manages the password credential. To manage a different one, for example a PIN declared on the user type schema, set attribute = 'pin'; render the composable once per credential to let a user manage more than one. ChangeCredential requires ThunderIDProvider in its ancestor composable hierarchy. ChangeCredential collects only a new value and its confirmation, not the account's existing value. The self-service credential write path does not verify the current value today, so asking for one would only teach the user a false sense of security.
Parameters
| Name | Type | Description |
|---|---|---|
| modifier (optional) | Modifier | Compose modifier applied to the form container. |
| attribute (optional) | String | The credential attribute this instance manages, any attribute the user type schema declares credential: true for. Defaults to "password". |
| onSuccess (optional) | (() -> Unit)? | Called after the credential has been changed successfully. |
import dev.thunderid.compose.components.presentation.user.ChangeCredential
@Composable
fun SecuritySection() {
Column {
Text("Security")
ChangeCredential()
}
}
Functions
Configuration
function
ThunderIDConfig is the configuration data class passed to ThunderIDClient.initialize(config, storage) and to the ThunderIDProvider composable.
Parameters
| Name | Type | Description |
|---|---|---|
| baseUrl | String | Required. Your Choreo Identity & Access Management instance URL. Must use HTTPS (e.g., https://<DATA_PLANE_URL>). |
| clientId | String? | The Client ID from your Choreo Identity & Access Management application. Required for redirect-based authentication and token operations. |
| scopes | List | OAuth 2.0 scopes to request. Include "profile" and "email" to receive user identity claims. |
| afterSignInUrl | String? | The redirect URI to return to after sign-in. Must match an Allowed Redirect URI registered in the console. |
| afterSignOutUrl | String? | The redirect URI to return to after sign-out. Must match an Allowed Post-Logout Redirect URI in the console. |
| signInUrl | String? | Override the sign-in URL. Defaults to the Choreo Identity & Access Management hosted sign-in page. |
| signUpUrl | String? | Override the sign-up URL. |
| clientSecret | String? | Client secret for confidential clients. Do not include this in a shipped Android app. |
| signInOptions | Map | Additional query parameters appended to the authorization URL on sign-in. |
| signOutOptions | Map | Additional parameters sent with the sign-out request. |
| signUpOptions | Map | Additional parameters sent with the sign-up request. |
| applicationId | String? | The Application ID used for app-native (embedded) sign-in flows via the Flow Execution API. |
| organizationHandle | String? | The organization handle for multi-tenant deployments. |
| tokenValidation | TokenValidationConfig | Controls ID token validation behavior. |
| storage | StorageAdapter? | Custom token storage backend. Defaults to EncryptedStorageAdapter. |
| instanceId | Int? | Identifies the SDK instance when running multiple instances in one process. |
import dev.thunderid.android.ThunderIDConfig
val config = ThunderIDConfig(
baseUrl = "https://<DATA_PLANE_URL>",
clientId = "<your-client-id>",
scopes = listOf("openid", "profile", "email"),
afterSignInUrl = "dev.thunderid.app://callback",
afterSignOutUrl = "dev.thunderid.app://logout",
applicationId = "<your-application-id>"
)
ThunderIDClient
function
ThunderIDClient is the core authentication client in the dev.thunderid:android library. It manages the full authentication lifecycle: initialization, sign-in (both app-native and redirect-based), session, token management, and user profile operations. When you use the dev.thunderid:compose library, a ThunderIDClient instance is created and managed automatically. You can access it via LocalThunderID.current.client from any composable.
import dev.thunderid.android.ThunderIDClient
import dev.thunderid.android.ThunderIDConfig
val client = ThunderIDClient()
client.initialize(
config = ThunderIDConfig(
baseUrl = "https://<DATA_PLANE_URL>",
clientId = "<your-client-id>",
scopes = listOf("openid", "profile", "email"),
afterSignInUrl = "dev.thunderid.app://callback",
afterSignOutUrl = "dev.thunderid.app://logout"
)
)
ThunderIDState
function
ThunderIDState is the reactive authentication state class provided by the dev.thunderid:compose library. It holds the current user, loading state, and initialization status, and exposes the underlying ThunderIDClient for direct API calls. ThunderIDState is provided via LocalThunderID, a CompositionLocal injected by ThunderIDProvider. Any composable in the hierarchy can read it using LocalThunderID.current.
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import dev.thunderid.android.ThunderIDConfig
import dev.thunderid.compose.ThunderIDProvider
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
ThunderIDProvider(
config = ThunderIDConfig(
baseUrl = "https://<DATA_PLANE_URL>",
clientId = "<your-client-id>",
afterSignInUrl = "dev.thunderid.app://callback",
afterSignOutUrl = "dev.thunderid.app://logout"
)
) {
AppContent()
}
}
}
}
Was this page helpful?