Skip to content

Conversation

bobbor
Copy link
Member

@bobbor bobbor commented Jul 11, 2025

Description of changes

Introduce the possibility of listening to crossTab auth events.

The changes introduce a listener for storage events on the DefaultStorage (window.localStorage) as well as on the SessionStorage (window.sessionStorage)

since the logic for adding and removing listeners is on the KeyValueStorage it is (theoretically) possible in future to add listeners for crossTab events on CookieStorage and CustomStorage.

since it listens to all storage events, it then filters the event based on token-naming convention to dispatch crossTab Hub events on the "auth" channel.

the typing and implementation of dispatch and listen on the hub makes sure, that only auth-channel events are allowed for crossTab communication.

Issue #, if available

Issue 12820

Description of how you validated changes

I added unit-tests and did manual explorative testing.

Checklist

  • PR description included
  • yarn test passes
  • Unit Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
    • will be done in a follow-up PR

Checklist for repo maintainers

  • Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
  • New source file paths included in this PR have been added to CODEOWNERS, if appropriate

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@bobbor bobbor force-pushed the feature/12820/crossTab-signIn-signOut branch from de72c25 to 1b8a803 Compare July 14, 2025 11:36
@bobbor bobbor requested a review from a team as a code owner July 14, 2025 11:36
@bobbor bobbor force-pushed the feature/12820/crossTab-signIn-signOut branch 2 times, most recently from c82b5ab to e9c1725 Compare July 14, 2025 13:23
@bobbor bobbor requested a review from sarayev as a code owner September 19, 2025 10:36
@bobbor bobbor force-pushed the feature/12820/crossTab-signIn-signOut branch from 896595b to ccfd497 Compare October 15, 2025 11:48
@bobbor bobbor force-pushed the feature/12820/crossTab-signIn-signOut branch from ccfd497 to 6bd538e Compare October 15, 2025 12:10
});

describe('setupNotify', () => {
it('should setup a KeyValueStorageEvent listener', async () => {
Copy link
Member

@ahmedhamouda78 ahmedhamouda78 Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we split this into multiple tests? It will make debugging easier in case of failures


it('should not allow crossTab dispatch in other channels', () => {
Hub.dispatch(
// this looks weird but is only used to mute TS.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

Copy link
Member

@ahmedhamouda78 ahmedhamouda78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one minor comment on one of the tests. Other than that, looks good to me!

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.

2 participants