Is there a way to connect to a SignalR hub using server and by using current session for authentication?

66 Views Asked by At

I am trying to implement connect to a SignalR hub using C# not JavaScript. I want to connect to the hub and invoke some methods on the hub.

I am able to create the connection like this

var connection = new HubConnectionBuilder()
.WithUrl("https://currentsite.com")
.Build();

await connection.InvokeAsync("test");

....

The problem is that the hub require authentication. The question, is there a way to connect to the hub (on the same app) using the current authenticated session?

0

There are 0 best solutions below