ComposeAuth
sealed interface ComposeAuth : SupabasePlugin<ComposeAuth.Config> , CustomSerializationPlugin(source)
Plugin that extends the Auth Module with composable function that enables an easy implementation of Native Auth. Currently supported Google Login (Android with OneTap or CM on Android 14+) and Apple Login (iOS), other compose-supported targets rely on GoTrue login.
To use it, install GoTrue and ComposeAuth
val client = createSupabaseClient(supabaseUrl, supabaseKey) {
install(GoTrue) {
//your config here
}
install(ComposeAuth) {
googleNativeLogin(/* your config parameters here */)
appleNativeLogin(/* your config parameters here */)
}
}
Content copied to clipboard
then on you screen call
val action = auth.rememberSignInWithGoogle(
onResult = {
// returns NativeSignInResult
},
fallback = {
// optional: only add fallback if you like to use custom fallback
}
)
Button(
onClick = {
action.startFlow()
}
) {
Text(text = "Google Login")
}
Content copied to clipboard
Types
Link copied to clipboard
Link copied to clipboard
data class Config(var googleLoginConfig: GoogleLoginConfig? = null, var appleLoginConfig: AppleLoginConfig? = null, var serializer: SupabaseSerializer? = null) : CustomSerializationConfig
Config for ComposeAuth
Functions
Link copied to clipboard
Composable of default behavior if Native Auth is not supported on the platform
Link copied to clipboard
expect fun ComposeAuth.rememberSignInWithApple(onResult: (NativeSignInResult) -> Unit, fallback: suspend () -> Unit = { fallbackLogin(Apple) }): NativeSignInState
Composable function that implements Native Apple Auth.
actual fun ComposeAuth.rememberSignInWithApple(onResult: (NativeSignInResult) -> Unit, fallback: suspend () -> Unit): NativeSignInState
Composable for Apple login with default behavior
Link copied to clipboard
expect fun ComposeAuth.rememberSignInWithGoogle(onResult: (NativeSignInResult) -> Unit = {}, fallback: suspend () -> Unit = {
fallbackLogin(Google)
}): NativeSignInState
Composable function that implements Native Google Auth.
actual fun ComposeAuth.rememberSignInWithGoogle(onResult: (NativeSignInResult) -> Unit, fallback: suspend () -> Unit): NativeSignInState
Composable function that implements Native Google Auth.