gustavo-armenta / CookieAuthenticationSample

Protected SignalR endpoint webhosted or selfhosted can be accessed by authenticated C# and/or JS client
56 stars 19 forks source link

IE doesn't work first time #3

Closed xqiu closed 11 years ago

xqiu commented 11 years ago
  1. In WebHost, regietser user with password as password
  2. Verify IE works for AuthorizeEchoHub, close IE
  3. Start IE, enter JavaScriptClient's AuthorizeEchoHub.html url: http://localhost:31111/AuthorizeEchoHub.html

Actual:

SignalR Hub.

Only an authenticated user can connect to this Hub. •stateChanged: disconnected => connecting •starting •login.get.done •Error: Message=Error during negotiation request. Stack=undefined Message=Error parsing negotiate response. Stack=undefined Message=Invalid character Stack=SyntaxError: Invalid character at _parseResponse (http://localhost:8080/Scripts/jquery.signalR-2.0.0-rc1.js:335:17) at success (http://localhost:8080/Scripts/jquery.signalR-2.0.0-rc1.js:652:29) at fire (http://localhost:8080/Scripts/jquery-1.8.2.js:974:5) at fireWith (http://localhost:8080/Scripts/jquery-1.8.2.js:1082:7) at done (http://localhost:8080/Scripts/jquery-1.8.2.js:7788:5) at callback (http://localhost:8080/Scripts/jquery-1.8.2.js:8500:8) •start.fail Error: Error during negotiation request. •disconnected •stateChanged: connecting => disconnected •login.post.done

Note, F5 will make it work in the following sessions until IE is closed and restart again.

xqiu commented 11 years ago

I get it fixed with https://github.com/gustavo-armenta/CookieAuthenticationSample/commit/24f9462da7a0622b1f97ed05e9588e57afce4def . Now when transiting from JavaScript client page, e.g. from http://localhost:31111/AuthorizeEchoConnection.html to AuthorizeEchoHub.html, you might get anti-forgery error: "The provided anti-forgery token was meant for a different claims-based user than the current user.". I'll track it with another issue.

xqiu commented 11 years ago

gustavo-armenta also fixed it in his changesets which is only 20 minutes after mine...