标签:获取 author signalr 客户 ring sign start ret with
一、客户端请求SignalR时,将Token放入QueryString
var connection = new HubConnectionBuilder().WithUrl($"http://xxx/signalr?Bearer={Token}").Build();
二、在Startup中,在UseAuthentication之前获取Token并放入Header
app.Use((context, next) => { if (context.Request.Query.TryGetValue("Bearer", out var token)) context.Request.Headers.Add("Authorization", $"Bearer {token}"); return next.Invoke(); });
标签:获取 author signalr 客户 ring sign start ret with
原文地址:https://www.cnblogs.com/liyanjie8712/p/10889778.html