Blazor Auth: Replace history entry on navigating to IdP login/register endpoints to avoid navigation cycle #43063
Labels
area-blazor
Includes: Blazor, Razor Components
bug
This issue describes a behavior which is not expected - a bug.
feature-blazor-wasm
This issue is related to and / or impacts Blazor WebAssembly
Milestone
Is there an existing issue for this?
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
orauthentication/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
/
toauthentication/login
, they get redirected to the IdP login page. Pushing the browser's "back" button gets them toauthentication/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.The text was updated successfully, but these errors were encountered: