I am trying to integrate signalR with an existing Single Page Application. So I have an ASP.NET application that hosts a signalR hub class. My JavaScript client attaches to the hub and waits for a notification. It works so far. But the problem comes when I try to make authentication. I need only authenticated users to be able to deal with the hub. Our authentication is with an access token. From all examples over internet I found that this token could be sent to the hub by a query string.
$.connection.hub.qs = "Bearer=" + authService.accessToken;
But the problem here is that this token could be seen in every tool that can observe the HTTP requests. So how can I protect or avoid this to happen.
From all the posts I found there are examples with
var authenticationTicket = Startup.AuthServerOptions.AccessTokenFormat.Unprotect(token);
It seems the token has been protected. But there are no examples how ?
Is there a clean example of this?
Thanks!