SignalR uses the same user authentication mechanism as the encapsulating web app, which means if a user is authenticated to the app, it is authenticated to SignalR. It is possible to send a JWT token upon each request too, and it's done like this:
var connection = new signalR.HubConnectionBuilder()
.withUrl('/chat', { accessTokenFactory: () => '<token>' })
.build();
Notice the accessTokenFactory argument; here, we are passing a lambda (it could be a function) that returns a JWT token. On the client code, if you are calling SignalR from an outside app, you need to do this:
var connection = new HubConnectionBuilder()
.WithUrl("http://<servername>/chat", options =>
{
options.AccessTokenProvider = () => Task.FromResult("<token>");
})
.Build();
Where SignalR is concerned, the identity of users is dictated by their connection ID....