public async Task InitializeAsync() { await SetupDb(); var cookies = await RegularUser.AuthorizeClient("User", "123"); await ManagerUser.AuthorizeClient("Manager", "123"); await AdminUser.AuthorizeClient("Admin", "123"); Hub = new HubConnectionBuilder().WithUrl(new Uri(Server.BaseAddress, "ws/chat"), options => { options.HttpMessageHandlerFactory = _ => Server.CreateHandler(); options.Headers.Add("Cookie", cookies); }) .Build(); }