-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
area-signalrIncludes: SignalR clients and serversIncludes: SignalR clients and servers
Milestone
Description
Hi, I have just converted my SignalR project to use AZure SignalR Service.
I am able to connect, and I can access the context from inside my hub, however, I cannot now access the context from outside of the hub.
Previously I used IHttpContextAccessor (see below) and this worked until I made the change to uas Azure SignalR service. Now everything works as it did before but the context being injected using the IHttpContextAccessor is always null.
Is there another way (or documentation) on how to access the context using Azure SignalR service from outside of the hub?
public class UserHelper
{
private readonly IHttpContextAccessor _context;
public UserHelper(IHttpContextAccessor context)
{
_context = context;
}
public string GetUserToken()
{
return _context.HttpContext.User.Claims.FirstOrDefault(c => c.Type == "access_token")?.Value;
}
}
Metadata
Metadata
Assignees
Labels
area-signalrIncludes: SignalR clients and serversIncludes: SignalR clients and servers