-
Notifications
You must be signed in to change notification settings - Fork 7
Description
The current implementation of the LoginController has incorrect callback handling behavior.
When loginWithBrowser is called, a loginCallback parameter is passed. This callback is stored in the singleton and is invoked after the Custom Tabs flow completes and the subsequent handleToken function succeeds.
Similarly, when logoutWithBrowser is called, the same handleToken needs to be executed and triggers the logoutCallback instead.
However, neither loginCallback nor logoutCallback is ever reset after completion. This leads to unintended callback executions in later operations.
Steps to Reproduce
Scenario 1
- Login with LoginCallback A
- Logout with LogoutCallback B
- Login again with LoginCallback C
Observed: Both LoginCallback C and the previous LogoutCallback B are invoked.
Scenario 2
- User is already logged in
- Logout with LogoutCallback A
- Login with LoginCallback B
- Logout again with LogoutCallback C
Observed: Both LogoutCallback C and the previous LoginCallback B are invoked.
Expected Behavior
Each callback (loginCallback and logoutCallback) should be reset or cleared after being invoked to prevent lingering side effects.
Impact
This behavior can cause unexpected post-login or post-logout actions to run multiple times, leading to inconsistent authentication states or UI updates.