Passing token through http Headers SignalR

前端 未结 6 1045
陌清茗
陌清茗 2020-12-04 16:45

I can see that there is an option in HubConnection to pass parameters through url request from client. Is there any way to pass specific token through http headers from JS o

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-04 17:36

    using Microsoft.AspNet.SignalR.Client;
    
    HubConnection = new HubConnection(_url);
    HubProxy = HubConnection.CreateHubProxy(_hubname);
    HubConnection.Headers.Add("Authorization", "Bearer "+authToken);
    HubConnection .Start().Wait();
    

提交回复
热议问题