Conversation
…tion that owns it (#2454) * refactor(auth): let the phone screen own its verification loading state * fix(auth): read auth state per authUI instance when clearing loading on dispose
…lot (#2452) * feat(auth): reshape reauthContent into a ReauthContentState content slot * fix(auth): address reauth review findings and retain state across recreation * refactor(auth): make reauthentication a request-scoped state machine * fix(auth): keep a proved reauthentication alive when its operation signs out * fix(auth): tear down phone verification when a reauthentication attempt fails * test(auth): cover sign-out-during-retry and phone reauth failure end to end * test(auth): drop the flaky phone reauth e2e case
…lment (#2462) * test(auth): pin onComplete and factor refresh on successful MFA enrollment * test(auth): pin the SMS MFA enrollment route through send, verify and resend * test(auth): pin the missing TOTP secret guard and the resend's clean enroll
…slot's sheet chrome (#2476) * test(auth): cover the three recoveries that write a value through to the step they move to * test(auth): assert a custom reauth slot's email and phone steps stay inside the library sheet
…and a screen-scoped phase holder
… FirebaseAuthUI singleton
… a stale composition value
… of returning quietly
…ad of calling it arming
…tead of the shared state flow
There was a problem hiding this comment.
Code Review
This pull request refactors the sign-out flow in FirebaseAuthUI to ensure that provider-side sessions (Google and Facebook) are cleared properly. Since auth.signOut() clears the current user, the linked providers are now captured from providerData beforehand. Additionally, the Facebook sign-out logic is guarded to handle cases where the Facebook SDK is not present at runtime. Feedback on these changes suggests avoiding catching Throwable in signOutFromFacebook to prevent swallowing critical JVM errors, recommending catching LinkageError and Exception separately instead.
| try { | ||
| if (Provider.fromId(auth.currentUser?.providerId) != Provider.FACEBOOK) return | ||
| loginManagerProvider.logOut() | ||
| } catch (e: Exception) { | ||
| } catch (e: Throwable) { | ||
| Log.e("FacebookAuthProvider", "Error during Facebook sign out", e) | ||
| } |
There was a problem hiding this comment.
Catching Throwable is generally discouraged as it swallows critical JVM errors such as OutOfMemoryError, StackOverflowError, or ThreadDeath. Since the Facebook SDK is a compileOnly dependency, missing classes will throw a NoClassDefFoundError (which extends LinkageError). Catching LinkageError and Exception separately allows you to safely handle both the missing SDK scenario and any runtime exceptions without swallowing critical system errors.
try {
loginManagerProvider.logOut()
} catch (e: LinkageError) {
Log.e("FacebookAuthProvider", "Facebook SDK not available or mismatched", e)
} catch (e: Exception) {
Log.e("FacebookAuthProvider", "Error during Facebook sign out", e)
}There was a problem hiding this comment.
Done, narrowed to LinkageError plus Exception. That covers both compileOnly failure modes (absent SDK, version mismatch) without swallowing OutOfMemoryError and friends.
bca0e64 to
2404066
Compare
FirebaseAuthUI.signOut()never cleared the provider-side session. Both provider logout helpers ran afterauth.signOut()had already clearedcurrentUser, and their guard testedFirebaseUser.providerId, which the SDK always reports as"firebase", so neither ever executed. A Google user's saved credential state survived sign-out, silently re-selecting the same account on the next sign-in instead of showing the picker, and a Facebook user was never logged out.signOut()now reads the linked providers fromproviderDatabefore signing out of Firebase, then clears each provider's session from the call site. The Facebook branch is additionally gated onProviderAvailability.IS_FACEBOOK_AVAILABLE, sincefacebook-loginiscompileOnlyandproviderDatacan carryfacebook.comfor an account linked on another platform. Both helpers lose their now-unreachable internal guard and unusedauthparameter;signOutFromGooglerethrowsCancellationExceptioninstead of swallowing it.Added two
FirebaseAuthUITestcases and the first e2e coverage ofFirebaseAuthUI.signOut(), verified to fail on the old code and pass with the fix. Three pre-existing tests stubbedmockUser.providerIdto values the real SDK never returns, which is what hid the bug; those stubs are gone.Maintainer note: Fixes internal CPRN-435