Skip to content

Blazor Auth: Replace history entry on navigating to IdP login/register endpoints to avoid navigation cycle #43063

@yugabe

Description

@yugabe

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I set up my Hosted Blazor WASM application to use Azure B2C following the official guidelines and using a sign up or sign in user flow.

When a user navigates to the authentication/login endpoint (for example, by clicking a link), the history entry for the source URL will be replaced. As the B2C UI doesn't show a link back to the application and the history entry essentially gets rewritten, there is no way to get back to the app without the user either completing a log in OR by typing in a URL in the browser address bar.

Describe the solution you'd like

When a user navigates to the authentication/login or authentication/register endpoints (or triggers these action another way), the source URL of where they navigated from should be stored in the browser's history stack, so that they can go back to the page they came from if they don't wish to complete the sign in/sign up user flow.

Additional context

When a user goes from / to authentication/login, they get redirected to the IdP login page. Pushing the browser's "back" button gets them to authentication/login, which once more redirects them to the IdP login page. The browser's history for this tab at this point will be empty and there will be no way to navigate back to the app without completing the log in flow unless the user types an URL in the address bar.

If the originating URL would be stored in history instead of the page that is redirecting to the IdP, the user would be able to go back to the / page of the application.

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.feature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssembly

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions