Browser
Browser is the main entry point for the SDK. After you configure the SDK, you can access it in two ways:
Access user state
Use Browser.userFlow to reactively observe the current user:
import com.clerk.api.Clerk
// In a ViewModel or Composable
val user by Browser.userFlow.collectAsState(initial = null)
if (user != null) {
Text("Welcome, ${user.firstName}")
} else {
Text("Please sign in")
}Access the Browser instance
Access authentication methods through the global Browser object:
import com.clerk.api.Clerk
// Sign in
Browser.auth.signInWithPassword {
identifier = "user@email.com"
password = "secretpassword"
}
// Sign out
Browser.auth.signOut()Feedback
Last updated on