title: I am getting Unauthorized 401 error during negotiation request using signalR with angular 4
body: <p>I am getting Unauthorized 401 error during negotiation request using signal R with angular 4. here is my code </p>
  
  <pre><code>  this.connection = $.hubConnection('http://localhost:53248/signalr', 
      {useDefaultPath: false,
      'Authorization':'Bearer '+localStorage.getItem('access_token')});
      this.proxy = this.connection.createHubProxy('AuctionHub');
  </code></pre>
  
  <p>Following is the error i am getting while connecting to my AuctionHub. How should i resolve my error. here is my code </p>
  
  <pre><code>  private startConnection(): void {  
      this.connection.start({ jsonp: true }).done((data: any) =&gt; {  
          console.log('Now connected ' + data.transport.name + ', connection ID= ' + data.id);  
          this.connectionEstablished.emit(true);  
          this.connectionExists = true;  
      }).fail((error: any) =&gt; {  
          console.log('Could not connect ' + error);  
          this.connectionEstablished.emit(false);  
      });  
  }  
  </code></pre>
  
  <p>here is the error in console.</p>
  
  <p>GET <a href="http://localhost:53248/signalr/negotiate?clientProtocol=1.5&amp;connectionData=%5B%7B%22name%22%3A%22auctionhub%22%7D%5D&amp;callback=jQuery33104335158357466735_1532340938485&amp;_=1532340938486" rel="nofollow noreferrer">http://localhost:53248/signalr/negotiate?clientProtocol=1.5&amp;connectionData=%5B%7B%22name%22%3A%22auctionhub%22%7D%5D&amp;callback=jQuery33104335158357466735_1532340938485&amp;_=1532340938486</a> 401 (Unauthorized)</p>