✅ SignalR Authorized Connection
hello, i am initiating a connection on this Hub, however when i add [Authorized] the connection is failing
even tho I am adding the accessTokenFactory. Am i doing something wrong?
namespace LebUpwork.Api.Hubs
{
//[Authorize] <- This causes error when connecting
public class NotificationHub : Hub<INotification>
{
public override async Task OnConnectedAsync()
{
await Clients.Client(Context.ConnectionId).ReceiveNotification($"Thank you for connecting {Context.User?.Identity.Name}");
await base.OnConnectedAsync();
}
}
}const connection = new HubConnectionBuilder()
.withUrl("https://localhost:7170/Hubs/NotificationHub", {
accessTokenFactory: () => token,
skipNegotiation: true,
transport: HttpTransportType.WebSockets,
})
.build();