Skip to content

Regression: HTTP 401 When refreshing page using MS Entra ID Auth (Blazor - WASM + Server) #52586

Open

Description

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When refreshing a Blazor page that has @attribute [Authorize], the browser gives a HTTP 401, even though the user is logged in.

Similar to #52317, but we're not using a custom auth provider. We're using MS Entra ID as per the .NET 7 docs https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/hosted-with-microsoft-entra-id?view=aspnetcore-7.0. This issue was introduced when migrating the project to .NET 8.

Expected Behavior

It should load the page.

Steps To Reproduce

dotnet new blazorwasm -ho -au SingleOrg --api-client-id "{api-client-id}" --app-id-uri "{app-id-uri}" --client-id "{client-id}" --default-scope "API.Access" --domain "{domain}" -o "Project" --tenant-id "{tenant-id}" --framework net7.0

Exceptions (if any)

No response

.NET Version

8.0.100

Anything else?

The article https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/hosted-with-microsoft-entra-id?view=aspnetcore-7.0 was removed from the .NET 8 docs.

I've read #52317 (comment), but it's not clear how that applies to MS Entra ID auth, and since there's no documentation on this scenario anymore, It's not clear what to do.

Prerendering is disabled:
App.razor

<HeadOutlet @rendermode="new InteractiveWebAssemblyRenderMode(prerender: false)"/>
...

<Routes @rendermode="new InteractiveWebAssemblyRenderMode(prerender: false)" />

My App.Razor is in the server project, my Routes.Razor is in the Client project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

DocsThis issue tracks updating documentationarea-blazorIncludes: Blazor, Razor Components

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions