feat(auth): reshape reauthContent into a ReauthContentState content slot - #2452
Open
demolaf wants to merge 1 commit into
Open
feat(auth): reshape reauthContent into a ReauthContentState content slot#2452demolaf wants to merge 1 commit into
demolaf wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a robust reauthentication flow in FirebaseUI Auth for Android, separating operation-level cancellations (AuthState.Cancelled) from flow-level aborts (AuthState.Aborted). It adds support for a custom, stateless reauthContent slot in FirebaseAuthScreen while keeping credential exchanges owned by the library, locks the email field to read-only during reauthentication, and resolves several state-resetting edge cases. The review feedback suggests making the OAuth reauthentication path more robust and fail-fast by explicitly throwing an exception if auth.currentUser is unexpectedly null, rather than silently failing with a safe call.
demolaf
force-pushed
the
feat/reauth-content-state-slot
branch
2 times, most recently
from
August 25, 2026 00:38
5dfbe74 to
81b3b32
Compare
demolaf
changed the base branch from
version-10.0.0-beta04-old
to
version-10.0.0-beta04
August 25, 2026 00:42
demolaf
marked this pull request as ready for review
August 25, 2026 09:22
demolaf
force-pushed
the
feat/reauth-content-state-slot
branch
from
August 25, 2026 09:27
81b3b32 to
1e1858f
Compare
demolaf
force-pushed
the
feat/reauth-content-state-slot
branch
from
August 25, 2026 09:36
1e1858f to
82c68c0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
reauthContentwas documented and shaped as a content slot alongsideemailContent,phoneContentand the MFA slots, but it received only(AuthState.ReauthenticationRequired, onDismiss)and every API needed to build a reauthentication UI —filterToLinkedProviders,isReauthenticationMode, the federated provider driver — wasinternalorprivate. A custom slot could therefore only perform email/password reauthentication and had to dead-end for a Google- or OAuth-only account. The success handoff was also easy to get wrong:onDismissreset auth state toIdlewhileretryOperationemittedAuthState.Success, so both orderings a caller would naturally reach either clobbered the success or cancelled the scope the retry ran in, silently dropping the sensitive operation.reauthContentnow receives a singleReauthContentStatecarrying the user, the reason, the providers already filtered to those linked to that user, and callbacks to select a provider or dismiss. The caller renders a provider chooser; the library owns credential exchange and dismiss/retry sequencing, so federated reauthentication is expressible from a custom slot and the ordering contract is no longer the caller's problem. SelectingAuthProvider.EmailorAuthProvider.Phonehands off to the library's own sub-flow, honouring the caller'semailContent/phoneContent.reauthContenttakes a singleReauthContentStateinstead of(state, onDismiss).AuthState.Successcan no longer be constructed outside the library. It now records which uid a reauthentication re-proved, and that proof must not be forgeable by app code.ReauthContentState.kt: new public state holder, following theMfaEnrollmentContentStateconventions.FirebaseAuthScreen.kt: the already-computed linked-provider list now reaches the slot instead of being discarded; the pending operation is consumed only for a library-published success on the same uid; provider selection and error-dialog recovery are inert while reauthentication is armed.AuthState.kt:SuccessgainsreauthenticatedUidand aninternalconstructor.EmailAuthProvider+FirebaseAuthUI.kt,OAuthProvider+FirebaseAuthUI.kt: stampreauthenticatedUidwhere the reauthenticated identity is known; account creation is rejected outright in reauthentication mode.SignInUI.kt: the sign-up route is hidden in reauthentication mode, and Credential Manager autofill is skipped so a saved password for another account cannot be auto-submitted.EmailAuthScreen.kt,ResetPasswordUI.kt,SignInEmailLinkUI.kt: the reauth email screen is prefilled with the signed-in address and renders it read-only in every mode that shows it.Added
FirebaseAuthScreenReauthContentStateTestandEmailAuthScreenReauthEmailLockTest, plus e2e coverage of reauthentication through the slot — each new test verified to be load-bearing by temporarily reverting the fix and confirming it fails.Usage