Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blazor WASM and IdentityServer4 - AuthenticationState out of sync when using multiple tab pages in chromium #24979

Closed
njannink opened this issue Aug 17, 2020 · 9 comments
Labels
affected-few This issue impacts only small number of customers area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-blazor-wasm-auth severity-minor This label is used by an internal tool

Comments

@njannink
Copy link

Defect description

We have the following defect when opening our blazor website in multiple chrome tab pages. That when you logout and login a different user in the second tab this isn't notified in the first tab so the first tab displays the wrong logged-in user and that can make things confusing.

Repro scenario

  • Start blazor wasm website with IdentityServer4 as authentication provider
  • Open page in tab1 of chrome and login "User 1"
  • Open page in tab2 of chrome and see that "User 1" is logged in and logout this user
  • No notification in tab1 that user is logged out AuthenticationStateProvider.AuthenticationStateChanged is not triggered
  • Try to do something in tab1 gives "Not authorized" because no user logged in

What do I need to change in my configuration so a notification is send to the first tab page that the user was logged out / logged in in a different tabpage in chrome? If there is no out of the box solution for this I might add a custom SignalR event to send this notification.

In my current setup I user the default `builder.Services.AddApiAuthorization();'

@javiercn
Copy link
Member

@njannink thanks for contacting us.

I'm not sure we support this explicitly.

I believe this should work automatically though OpenID Connect session management (which works through an iframe).

We don't trigger any notification, but we poll the underlying JS interop layer about once per minute I believe and we subscribe to userSignedOut in the oidc-client.js library, so it should eventually propagate to other tabs I think.

@javiercn javiercn added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly labels Aug 18, 2020
@njannink
Copy link
Author

I don't see any updates in first tab also not after a minute.

@javiercn
Copy link
Member

I happen to be working on the IdentityServer4 update, so I'll give it a quick try to see if there is something easy we can do to enable this.

@captainsafia captainsafia self-assigned this Aug 18, 2020
@captainsafia captainsafia added this to the 5.0.0-rc1 milestone Aug 18, 2020
@javiercn javiercn added enhancement This issue represents an ask for new feature or an enhancement to an existing one and removed investigate labels Aug 19, 2020
@ghost
Copy link

ghost commented Aug 19, 2020

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@SteveSandersonMS SteveSandersonMS added affected-few This issue impacts only small number of customers severity-minor This label is used by an internal tool labels Oct 7, 2020 — with ASP.NET Core Issue Ranking
@ghost
Copy link

ghost commented Oct 9, 2020

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@mtavares628
Copy link

It's been almost a year since this was moved to the Backlog. Is there any movement on this where we can expect it in .NET 6? And if not, is there a suggested workaround, so that logging out of an app from one tab can notify the other tabs?

@mkArtakMSFT mkArtakMSFT added Docs This issue tracks updating documentation and removed enhancement This issue represents an ask for new feature or an enhancement to an existing one labels Oct 24, 2022
@mkArtakMSFT mkArtakMSFT modified the milestones: Backlog, 8.0-MQ Oct 24, 2022
@javiercn
Copy link
Member

This is not something that oidc-client.js supports out of the box.

Very likely this requires a custom auth implementation that notifies other apps in the same browser using something like https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel

@javiercn javiercn removed the Docs This issue tracks updating documentation label Dec 30, 2022
@javiercn javiercn modified the milestones: 8.0-MQ, Backlog Dec 30, 2022
@javiercn javiercn added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label Dec 30, 2022
@ghost
Copy link

ghost commented Dec 30, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@javiercn javiercn removed their assignment Dec 30, 2022
@mkArtakMSFT mkArtakMSFT modified the milestones: Backlog, BlazorPlanning Nov 5, 2023
@mkArtakMSFT
Copy link
Member

Closing this as the work will be covered by #40764 and the link will hopefully give enough context for the remaining work there to consider the scenario.

@mkArtakMSFT mkArtakMSFT closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Feb 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affected-few This issue impacts only small number of customers area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-blazor-wasm-auth severity-minor This label is used by an internal tool
Projects
None yet
Development

No branches or pull requests

6 participants