Skip to content

Improve auth state provider guidance for BWAs #31496

@PMcVries

Description

@PMcVries

Description

Following the documentation I came across an issue configuring authentication and authorization for a Blazor Server app. The [Authorize] attribute kept redirecting to (I assume) my authentication scheme's fallback path instead of just displaying the fallback message "Not authorized. I used Cookie Authentication. Neither role-based, policy-based nor the default policy was recognized.
After some research I've found this workaround to fix this problem. https://github.com/dotnet/aspnetcore/issues/52317#issuecomment-1830673284

The workaround just inserts a middleware step and assumingly skips the redirections issue.

Please add this information into the documentation since it seems to be a recent problem since the introduction of .NET 8.
Thank you!

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-8.0#additional-resources

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/security/index.md

Document ID

1247ee64-fbc9-ce29-0710-f6e59380f5ee

Article author

@guardrex

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions