Example app demonstrating how to integrate the Loop8 Auth Android SDK using OpenID Connect (Authorization Code + PKCE). The SDK opens the Loop8 consumer app, completes the OAuth exchange, validates the ID token (RS256 + JWKS), and stores it encrypted on-device.
dependencies {
implementation("io.github.l8p8:auth:1.0")
}- Min SDK: 24
- Loop8 app (
com.l8p8.l8p8) must be installed for the interactive flow; otherwise the SDK opens the Play Store listing.
Declare package visibility for Android 11+:
<queries>
<package android:name="com.l8p8.l8p8" />
</queries>Call from Application.onCreate or before the first sign-in:
Loop8Auth.init(
context = this,
config = AuthConfig(
clientId = "YOUR_CLIENT_ID",
debug = BuildConfig.DEBUG, // enables verbose OkHttp logs
),
)The only way to start the sign-in flow is via Loop8SignInButton. There is no programmatic login entry point by design.
import com.loop8.auth.ui.Loop8SignInButton
Loop8SignInButton()The button handles loading state internally. Observe Loop8Auth.authState to react to results:
// Compose
val state by Loop8Auth.authState.collectAsState()
when (state) {
is AuthLoginState.InProgress -> { /* loading */ }
is AuthLoginState.Success -> { val idToken = state.idToken }
is AuthLoginState.Error -> {
when (state.reason) {
is AuthError.Denied -> { /* age verification failed */ }
is AuthError.UserCancelled -> { /* user dismissed */ }
else -> { /* other error */ }
}
}
null -> { /* idle / logged out */ }
}
// Coroutine
Loop8Auth.authState.collect { state -> … }Loop8Auth.logout()Clears the encrypted token and resets authState to null.
| Package | Contents |
|---|---|
com.loop8.auth.api |
Loop8Auth, AuthManager, AuthConfig, AuthLoginState, AuthResult, IdTokenClaims, AuthError, AuthLogger |
com.loop8.auth.ui |
Loop8SignInButton |
All internal packages are obfuscated by R8 and not part of the public contract.
Run the project. Demonstrates MVI setup with MainViewModel mapping Loop8Auth.authState to a UiState, rendered by a pure Compose screen.
See repository licensing terms.