Skip to content

Bug: Callbacks in LoginController are not reset after completion #22

@andreas-umbricht

Description

@andreas-umbricht

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

  1. Login with LoginCallback A
  2. Logout with LogoutCallback B
  3. Login again with LoginCallback C

Observed: Both LoginCallback C and the previous LogoutCallback B are invoked.

Scenario 2

  1. User is already logged in
  2. Logout with LogoutCallback A
  3. Login with LoginCallback B
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions