Skip to content

Make signedIn and signedOut event cross-tab #12820

@AllanZhengYP

Description

@AllanZhengYP

Is this related to a new or existing framework?

No response

Is this related to a new or existing API?

Authentication

Is this related to another service?

No response

Describe the feature you'd like to request

Currently the Hub event signedIn and signedOut is only sent to the current browser tab/window. Hence the useAuthenticator hook does not change session state from the sign-in or sign-out action from other tab.

I expect the following to work:

  1. Open tab 1 of example.com and render unauthenticated scene.
  2. Open tab 2 of example.com/sign-in and completes sign-in flow
  3. Both tabs rerender the authenticated scene automatically.

Describe the solution you'd like

The Hub listener can opt to listen to cross tab events:

Hub.listen('auth', callback, { fromCrossTab: true });

Now you are listening to other tabs.

Under the hood it can listen to the cookie/local storage events and looking for user session changes.

Describe alternatives you've considered

Right now users have to refresh to render the effects from the signedIn and signedOut events from other tabs.

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    AuthRelated to Auth components/categoryfeature-requestRequest a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions