GoogleButtonUiContainer

fun GoogleButtonUiContainer(modifier: Modifier = Modifier, filterByAuthorizedAccounts: Boolean = false, scopes: List<String> = BASIC_AUTH_SCOPE, onGoogleSignInResult: (GoogleUser?) -> Unit, content: @Composable UiContainerScope.() -> Unit)

GoogleButton Ui Container Composable that handles all sign-in functionality. Make sure you create GoogleAuthUiProvider instance using GoogleAuthProvider.create before invoking below composable function.

Child of this Composable can be any view or Composable function. You need to call UiContainerScope.onClick function on your child view's click function.

onGoogleSignInResult callback will return GoogleUser or null if sign-in was unsuccessful.

Example Usage:

//Google Sign-In with Custom Button and authentication without Firebase
GoogleButtonUiContainer(onGoogleSignInResult = { googleUser ->
val idToken = googleUser?.idToken // Send this idToken to your backend to verify
}) {
Button(onClick = { this.onClick() }) { Text("Google Sign-In(Custom Design)") }
}

Parameters

filterByAuthorizedAccounts

set to true so users can choose between available accounts to sign in.

scopes

Custom scopes to retrieve more information. Default value listOf("email", "profile") setting to false list any accounts that have previously been used to sign in to your app.