Skip to content

fix(auth): log out before Facebook sign-in to clear stale cached token#2322

Open
demolaf wants to merge 3 commits into
version-10.0.0-beta03from
fix/facebook-stale-token
Open

fix(auth): log out before Facebook sign-in to clear stale cached token#2322
demolaf wants to merge 3 commits into
version-10.0.0-beta03from
fix/facebook-stale-token

Conversation

@demolaf
Copy link
Copy Markdown
Member

@demolaf demolaf commented May 15, 2026

Closes #879

When a user switches accounts in the native Facebook app without signing out of FirebaseUI, the Facebook SDK retains a stale cached token. On the next sign-in attempt this caused a silent failure with "User logged in as different Facebook user".

Calling logOut() at the start of signInWithFacebook clears the local token cache before each sign-in, forcing a fresh authentication.

Copy link
Copy Markdown

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

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 a logOut() call to the Facebook sign-in flow to prevent stale token issues and includes a unit test for verification. The reviewer identified that the current placement of the logOut() call is likely too late to affect the current sign-in attempt and should be moved to the launcher. Furthermore, there is an inconsistency in the use of the login manager provider that should be addressed to ensure correct behavior when using test overrides.

@demolaf demolaf requested a review from russellwheatley May 15, 2026 11:45
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.

1 participant