Skip to content

fix(auth): stop showing error dialog when Google sign-in is cancelled - #2427

Draft
demolaf wants to merge 1 commit into
version-10.0.0-beta04from
fix/2422-google-signin-cancel
Draft

fix(auth): stop showing error dialog when Google sign-in is cancelled#2427
demolaf wants to merge 1 commit into
version-10.0.0-beta04from
fix/2422-google-signin-cancel

Conversation

@demolaf

@demolaf demolaf commented Jul 27, 2026

Copy link
Copy Markdown
Member

Fixes #2422.

Cancelling the Google sign-in Credential Manager sheet showed an "Authentication Error" dialog with the raw GetCredentialCancellationException message ("User cancelled the selector") as the button text, instead of returning silently via AuthState.Cancelled. signInWithGoogle only caught kotlinx.coroutines.CancellationException, not the actual exception Credential Manager throws on dismissal, so it fell through to the generic error path.

  • GoogleAuthProvider+FirebaseAuthUI.kt: catches GetCredentialCancellationException explicitly and updates AuthState.Cancelled without rethrowing, so the sign-in flow returns to the picker silently and onSignInCancelled fires.
  • ErrorRecoveryDialog.kt: getRecoveryActionText no longer uses the raw exception message as the button label for AuthCancelledException.

Added a test covering the Credential Manager cancellation path, and fixed ErrorRecoveryDialogLogicTest to exercise the real (now-internal) dialog logic functions instead of a stale duplicate that had drifted from the actual code.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds handling for GetCredentialCancellationException when a user dismisses the Credential Manager sheet during Google Sign-In, updating the authentication state to AuthState.Cancelled without throwing an exception. It also changes the visibility of getRecoveryMessage, getRecoveryActionText, and isRecoverable in ErrorRecoveryDialog.kt from private to internal, enabling direct testing and the removal of redundant helper methods in ErrorRecoveryDialogLogicTest.kt. There are no review comments, and I have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cancelling the Google sign-in sheet shows an error dialog with the raw exception message as button text (expected AuthState.Cancelled, no dialog)

1 participant