Credential Manager進行google sign
使用 Android 版 Credential Manager,進行google sign https://developers.google.com/identity/android-credential-manager @Composable fun SignInScreen (viewModel: CredentialSignInViewModel = CredentialSignInViewModel()) { val uiState by viewModel. uiState . collectAsState () val context = LocalContext . current Column ( modifier = Modifier . fillMaxSize () . padding ( 16 . dp ), horizontalAlignment = Alignment. CenterHorizontally , verticalArrangement = Arrangement. Center ) { Button ( onClick = { viewModel.signInWithGoogle( context = context, webClientId = "" // 替換為你的 Web 用戶端 ID ) } ) { Text ( "Sign in with Google" ) } Spacer ( modifier = Modifier. height ( 16 . dp )) when (uiState) { is CredentialSignInViewModel.UiState.Loading -> { ...