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

Regression, Blazor WASM OIDC login callback to not sent to the requested page when published #51870

Closed
1 task done
aguacongas opened this issue Nov 4, 2023 · 3 comments
Closed
1 task done
Assignees
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-blazor-wasm-auth Pillar: Technical Debt
Milestone

Comments

@aguacongas
Copy link
Contributor

aguacongas commented Nov 4, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I opened this issue #44973 for .Net 7 and it's occurs again for .Net 8 RC2

On login callback, the requested protected page should be display if the user has authorization. It was the case with .Net 6

Expected Behavior

The requested protected page should be display if the user has authorization

Steps To Reproduce

Using the code in the repo aguacongas/BlazorAuthIssue. It's a simple blazor wasm starter with OIDC authentication.

publish the server dotnet publish -c Release
Launch the published server with .\BlazorAuthIssue.Server.exe --urls http://localhost:5001
Click on Counter
Login with alice, pwd: Pass123$
The index page is displayed but the counter page should be displayed

Exceptions (if any)

No response

.NET Version

8.0.100-rc.2.23502.2

Anything else?

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Nov 4, 2023
@mkArtakMSFT mkArtakMSFT added bug This issue describes a behavior which is not expected - a bug. Pillar: Technical Debt feature-blazor-wasm-auth labels Nov 6, 2023
@mkArtakMSFT mkArtakMSFT added this to the Planning: WebUI milestone Nov 6, 2023
@aguacongas
Copy link
Contributor Author

Note also that logout stay stuck on Processing logout callback...

@sslaws
Copy link

sslaws commented Nov 24, 2023

Adding workaround described by #45028 but removing the reference to Microsoft.Authentication.WebAssembly.Msal resolved the Processing logout callback... issue.

@mkArtakMSFT mkArtakMSFT modified the milestones: Planning: WebUI, 8.0.x Dec 18, 2023
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
@halter73
Copy link
Member

The requested protected page should be display if the user has authorization

This is due to a documented breaking change in .NET 7 https://learn.microsoft.com/en-us/dotnet/core/compatibility/aspnet-core/7.0/wasm-app-authentication. tl;dr:

--- a/Client/Shared/RedirectToLogin.razor
+++ b/Client/Shared/RedirectToLogin.razor
@@ -1,8 +1,10 @@
-@inject NavigationManager Navigation
+@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
+
+@inject NavigationManager Navigation
 
 @code {
     protected override void OnInitialized()
     {
-        Navigation.NavigateTo($"authentication/login?returnUrl={Uri.EscapeDataString(Navigation.Uri)}");
+        Navigation.NavigateToLogin($"authentication/login");
     }
 }

Note also that logout stay stuck on Processing logout callback...

This is a trimming bug. It should be fixed by #54225 which we plan to backport for 8.0.x servicing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-blazor-wasm-auth Pillar: Technical Debt
Projects
Status: Done
Development

No branches or pull requests

5 participants