Skip to content

[BUG] Login loop and post-login navigation issues in Blazor WASM Hosted (.NET 8, Azure App Service) #63886

@carlorodriguezara

Description

@carlorodriguezara

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Problem summary

Developing a Blazor WASM Hosted application with .NET 8 and Azure App Service, I managed to break the classic OIDC login loop: now the user can authenticate and correctly enter the SPA (seeing "Your login was successful." at /authentication/login-callback). However, when trying to automatically navigate to the main page (/ or dashboard) after signing in, Blazor requests authentication again and returns to the login screen.

Achievements

  • The OIDC authentication flow completes successfully (.AspNetCore.Identity.Application cookie is created, success message is shown).
  • The user accesses the SPA after login, confirming that the initial authentication works.
  • The original login loop has been resolved.

Current issue

  • When navigating (automatically or manually) to the main page (/), Blazor again requires login.
  • The authenticated state is not maintained when switching pages within the SPA.
  • The issue appears both in Azure and in local environments.

Tests and technical evidence

  • Automatic redirect with delay using JavaScript and Blazor (NavigateTo("/") in <CompletingLoggingIn>).
  • Cookie and CORS configuration verified.
  • Using a single authentication page (Authentication.razor) with <RemoteAuthenticatorView Action="@Action">.
  • No manual redirect to login from the SPA.
  • [Authorize] on protected pages.
  • HTTPS enabled on client and server.

Impact and context

  • This issue prevents internal navigation post-login, affecting user experience and making productive use of the app in Azure impossible.
  • This is a contribution to the community, documenting progress and current framework limitations in this scenario.

Key questions for Microsoft and the community

  1. Is this a known bug in Blazor WASM Hosted on .NET 8 and Azure App Service?
  2. Is there any additional recommended configuration to persist authentication after login and allow navigation in the SPA?
  3. Do all Blazor WASM Hosted (.NET 8) developers face this issue when deploying to Azure?
  4. Is there any definitive workaround to avoid this behavior?

Visual evidence

Successful login message in SPA

Conclusion

  • The critical advance of breaking the login loop and accessing the SPA has been achieved.
  • The remaining challenge is persisting the authenticated state when navigating within the app.
  • This issue seeks a definitive solution and will serve as a reference for other developers facing this scenario.

Any contribution, workaround, or definitive solution to help the Blazor WASM Hosted community in Azure and .NET 8 is highly appreciated.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.Needs: ReproIndicates that the team needs a repro project to continue the investigation on this issueStatus: No Recent Activityarea-authIncludes: Authn, Authz, OAuth, OIDC, Bearerfeature-blazor-wasm-auth

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions