dotnet / dotnet/AspNetCore.Docs

SignalR `[Authorize]` does not work at class level

Open
#35,355 0 comments 0 reactions 1 assignee Assigned to @wadepickett View on GitHub
SignalR
Dominant language
C#
Stars
13.1k
Forks
24.6k
Avg merge
1d 2h
Merged PRs (30d)
109

Description

When running [this demo](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/signalr/authn-and-authz/6.0sample/SignalRAuthenticationSample), I get this error:

```SignalR connection failed Error: WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.```

This only happens when the `[Authorize]` attribute is on the Hub class. If I put the [Authorize] attribute on individual methods, or remove it, the connecting works.

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.