Android SDK Reference
Detailed reference for the core classes and methods in the AuthSetu Android SDK.
AuthSetuClient
The central entry point for the SDK.
initialize(context, publishableKey, baseUrl)
Static method to initialize the singleton instance.
getInstance()
Returns the initialized instance. Throws IllegalStateException if not initialized.
---
AuthService (Manual API Calls)
If you prefer to build your own UI, you can use the authService directly.
Manual Login Example
val client = AuthSetuClient.getInstance()
scope.launch {
val response = client.authService.login(
mapOf(
"email" to "user@example.com",
"password" to "secure_password"
)
)
if (response.isSuccessful) {
val authData = response.body()
// SDK automatically handles token storage if using internal services
// but you can also manually update sessionManager
}
}---
SessionManager
Handles persistence of tokens and user data.
| Property | Type | Description |
| :------------- | :--------- | :--------------------------------------- |
| accessToken | String? | Current JWT access token |
| refreshToken | String? | Token used to get new access tokens |
| user | User? | Data object for the authenticated user |
| session | Session? | Details about the current device session |
Clear Session (Logout)
client.sessionManager.clear() // Wipes all local auth data