ComposeAuth

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 */)
}
}

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")
}

Types

Link copied to clipboard
data class Config(var googleLoginConfig: GoogleLoginConfig? = null, var appleLoginConfig: AppleLoginConfig? = null, var serializer: SupabaseSerializer? = null) : CustomSerializationConfig

Config for ComposeAuth

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open suspend fun close()
Link copied to clipboard

Composable of default behavior if Native Auth is not supported on the platform

Link copied to clipboard
open fun init()
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.