Skip to content

MSAL login stucks during "Completing Login" in blazor wasm in .NET 9 #61991

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

Open
1 task done
mueller-marcel opened this issue May 19, 2025 · 2 comments
Open
1 task done
Labels
area-auth Includes: Authn, Authz, OAuth, OIDC, Bearer
Milestone

Comments

@mueller-marcel
Copy link

mueller-marcel commented May 19, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

In .NET 9 a published blazor wasm standalone app seems to stuck during the "Completing Login" stage when logging in using MSAl to an Entra ID. This happens exclusively in published apps. I could not observe it during local development. Furthermore this issue only appears in mobile browsers such as Safari, Chrome & Edge and under their android versions.

Sometimes especially when after the cache has been cleared it seems to work one time. After logging out and trying to log in again it stucks again.

I have seen the already resolved issue #52619 and pull request #54225 but this seems to be unresolved for .NET 9 using the latest MSAL nuget packages (9.0.5).

Expected Behavior

The login should complete and redirect to according page when trying to log in onb mobile browsers. I tested it with the Entra ID of my workplace

Steps To Reproduce

Repository to reproduce the issue: https://github.com/mueller-marcel/AuthTest

  1. Add the TenantId and the ClientId to the appsettings.json
  2. Publish the app
  3. Access the app and login using a mobile Phone. (I tested it with iOS 18.5)

Exceptions (if any)

If the cache is cleared before the blazor wasm is openend it seems to work one time. The next time the page is openend or the user logs out and in again the login stucks again.

.NET Version

Host: Version: 9.0.5 Architecture: x64 Commit: e36e4d1a8f .NET SDKs installed: 9.0.300 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Other architectures found: arm64 [C:\Program Files\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\arm64\InstallLocation] x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation] Environment variables: Not set global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/download

Anything else?

EDIT: It looks like the issue is gone when the LoginMode is set to redirect.

@github-actions github-actions bot added the area-blazor Includes: Blazor, Razor Components label May 19, 2025
@javiercn javiercn added area-auth Includes: Authn, Authz, OAuth, OIDC, Bearer and removed area-blazor Includes: Blazor, Razor Components labels May 19, 2025
@MackinnonBuck
Copy link
Member

Given that having LoginMode set to redirect works, we'd recommend doing that since pop ups can be blocked. We should consider changing the default here.

@MackinnonBuck MackinnonBuck added this to the Backlog milestone May 21, 2025
@mueller-marcel
Copy link
Author

@MackinnonBuck Thanks for the fast response! That sounds like a good idea to change the default to "redirect". Furthermore I was wondering why the LoginMode is a string. Would it be considerable to change it to a enum such as LoginMode.Redirect and LoginMode.Popup. I was just wondering about a string value to select between popup mode and redirect. Maybe an enum would make the use of the API less prone of errors due to capitalization errors, whitespaces and that stuff?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-auth Includes: Authn, Authz, OAuth, OIDC, Bearer
Projects
None yet
Development

No branches or pull requests

3 participants