Uh oh!
There was an error while loading. Please reload this page.
refactor(auth)!: decouple reauthentication from the FirebaseAuthUI shared state flow - #2478
Open
demolaf wants to merge 15 commits into
Open
refactor(auth)!: decouple reauthentication from the FirebaseAuthUI shared state flow#2478demolaf wants to merge 15 commits into
demolaf wants to merge 15 commits into
Conversation
…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
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the reauthentication flow in FirebaseUI Auth to use a composition-scoped AuthFlowScope and coroutine-based suspension (CompletableDeferred) instead of process-local callbacks on FirebaseAuthUI. This prevents sensitive operations from being lost or executed multiple times during Activity recreation. Various auth providers have been updated to emit states through this new scope. Feedback is provided to improve code safety in authUserState by avoiding the !! operator on user.email through smart casting.
Uh oh!
There was an error while loading. Please reload this page.
demolaf
marked this pull request as ready for review
September 4, 2026 11:37
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 freeto 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.
FirebaseAuthUIwas the SDK entry point, the process-wideAuthStatechannel and the reauthentication session store all at once. Reauthentication requests now travel on their own channel, provider code emits to anAuthFlowScopesink instead of the singleton's flow, and the phase machine lives in a composition-scoped holder — nine members deleted fromFirebaseAuthUI, none added.withReauthno longer retains the caller's lambda on a process-scoped singleton: it raises a request, suspends on a resolver, and retries on the caller's own coroutine.delete()goes through the same path instead of publishingRequiredand throwing.AuthFlowScope.kt: provider extensions move offFirebaseAuthUI, so provider code can no longer reach the public state flow at all — the isolation is compiler-held rather than review-held.ReauthFlowState.kt: the phase machine, scoped to oneFirebaseAuthScreen's composition.Abortednow clears the phase and resolves the caller under both hosts.SignInStateSequenceTestandReauthFlowStateTest, plus emulator-backed e2e coverage for a password change and an account deletion through reauthentication.AuthState.Reauthentication.Required.retryOperationis removed outright — pre-GA, zero external usage, no shim.AuthState.Reauthentication.Required's(user, reason)constructor is nowinternal. Raising a request iswithReauth/delete()'s job; constructing one yourself no longer did anything.AuthException.AuthCancelledExceptioninstead of returning quietly, anddelete()reports that rather thanInvalidCredentialsException.AuthState.Reauthentication.RequiredtoauthStateFlow()yourself no longer raises a request; onlywithReauthanddelete()do.Maintainer note: Fixes internal CPRN-413