I have a blazor server side web app that uses AAD for authentication. I have added SignalR to it according to the guidance. It starts up fine, but when I try to connect using the following code:
var hubUrl = _navigationManager.ToAbsoluteUri("messaging");
hubConnection = new HubConnectionBuilder()
.WithUrl(hubUrl)
.Build();
await hubConnection.StartAsync();
I get an exception. This the console debug trace:
[INF] Request finished HTTP/2 GET https://localhost:5001/css/insight-icons/fonts/Insight.woff2 - - - 304 - font/woff2 3.1879ms
[INF] Request starting HTTP/1.1 POST https://localhost:5001/messaging/negotiate?negotiateVersion=1 - 0
[INF] OpenIdConnect was not authenticated. Failure message: Not authenticated
[INF] Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
[INF] AuthenticationScheme: OpenIdConnect was challenged.
[INF] Request finished HTTP/1.1 POST https://localhost:5001/messaging/negotiate?negotiateVersion=1 - 0 - 302 0 - 962.8463ms
As mentioned I am logged in and authenticated using AAD.
Any suggestions as to what I am doing wrong of what is missing?