I am working on a chat application in Blazor and C#. The sample is really similar to this tutorial: https://www.youtube.com/watch?v=I9bA8elRULI
After deploying it to an Azure App Service everything works fine. If i turn on Azure AD authentication with Microsoft as an identity provider and an app registration i get an error. See browser dev tools.
Here is how i start my HubConnection:
hubConnection = new HubConnectionBuilder()
.WithUrl(NavigationManager.ToAbsoluteUri("/chatservice")).Build();
hubConnection.On<string, string>("ReceiveMessage", (user, message) =>
{
userMessages.Add(new UserMessage { Username = user, Message = message, isCurrentUser = user == usernameInput, DateSent = DateTime.Now });
this.InvokeAsync(() => this.StateHasChanged());
});
await hubConnection.StartAsync();
The error occurs in the last line hubConnection.StartAsync();
Hint: it´s not an option to turn off the authentication