dotnet / dotnet/aspnetcore

Blazor Authorization - AuthorizeRouteView and RedirectToLogin not working.

Open
#52,063 53 comments 44 reactions 1 assignee Claimed by @halter73 View on GitHub
area-auth cost: XS Docs feature-identity-ui
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

I've created Blazor WebApp via VS 2022 template with individual identity.
No matter what I do, `````` and `````` are not working and redirect any request to /Account/Login. putting ```

not working

``` doesn't help.

### Expected Behavior
```




not authorized





```
Prints "not authorized" when you click "Auth Required" in the template app

image

### Steps To Reproduce

1) Create Blazor Web App with Server Interactive render mode, and with Individual Account Authentication type.
2) Replace from "``````" to "```

not authorized

```" in Routes.razor (to see if your redirection is from RedirectToLogin component)
3) Click "Auth Required" in template app.

### Exceptions (if any)

_No response_

### .NET Version

8.0.100

### Anything else?

This is a blocker since I was migrating .NET 7.0 app to .NET 8.0, but It behaves very differently.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.