title: How to authenticate SignalR .NET Client with MVC5 ASP.NET Identity Framework
body: <p>I have been researching this for a while and cannot seem to figure it out.</p>
  
  <p><strong>I have a .NET SignalR Client that needs to be authenticated with ASP.NET Identity (MVC5) so that it can access SignalR hubs secured with the [Authorize] attribute.</strong></p>
  
  <p>I found the following resource (Please see Authentication options for .NET Clients / Cookie):</p>
  
  <p><a href="http://www.asp.net/signalr/overview/signalr-20/security/hub-authorization" rel="noreferrer">http://www.asp.net/signalr/overview/signalr-20/security/hub-authorization</a></p>
  
  <p>However the code sample for retrieving the cookie doesn't work due to:</p>
  
  <pre><code>authCookie = response.Cookies[FormsAuthentication.FormsCookieName];
  </code></pre>
  
  <p>and as I am  not using Forms Authentication this produces an error.</p>
  
  <p>I am unsure how to change this for ASP.NET Identity?</p>
  
  <p>Am I focused on the correct approach, ie. retrieving a cookie and then adding it to the Cookie Container? or should I be passing the Username and Password in headers to a Hub and authenticating somehow this way?</p>
  
  <p>I did not realise how confusing it would be to authenticate using a .NET client with SignalR and Identity Framework. </p>
  
  <p>Even though it is not my use case I am also tagging the question with Xamarin as I feel this might be an issue faced by Xamarin mobile developers using the SignalR .NET client also.</p>
  
  <p>As I cannot seem to find any examples on the Internet, any assistance would be much appreciated. Thanks.</p>