Azure Mobile Service requires authentication for SignalR HTML/Javascript Client -
i have fresh azure mobile service running locally @ localhost:52253. installed latest signalr nuget package: azure mobile services .net backend signalr extension 1.0.450
i have test html/javascript client served localhost:54697/
after working out cors issues, still cannot connect signalr hubs because negotiation requests signalr javascript client mobile service @ localhost:52232/signalr/negotiate result in http/1.1 401 unauthorized.
i have not enabled authentication on server, default. confirmed webapi controller works without authentication. i've tried decorating hub , hub methods with:
[authorizelevel(authorizationlevel.anonymous)] public class chathub : hub { public apiservices services { get; set; } [authorizelevel(authorizationlevel.anonymous)] public string send(string message) { return "hello signalr chat hub!"; } }
the exact request via fiddler is:
http://localhost:52253/signalr/negotiate?clientprotocol=1.4&connectiondata=%5b%7b%22name%22%3a%22chathub%22%7d%5d&_=1434677053589 http/1.1 host: localhost:52253 connection: keep-alive cache-control: max-age=0 accept: text/plain, */*; q=0.01 x-requested-with: xmlhttprequest user-agent: mozilla/5.0 (windows nt 6.3; wow64) applewebkit/537.36 (khtml, gecko) chrome/43.0.2357.124 safari/537.36 content-type: application/json; charset=utf-8 referer: http://localhost:52253 accept-encoding: gzip, deflate, sdch accept-language: en-us,en;q=0.8 cookie: ai_user=09b8290770484a41bec47ce63b379abf|2015-04-01t02:18:46.1194121+00:00; ai_session=ab23831e90cb4773b79353cd4e2963ff|2015-04-28t01:14:18.415z|2015-04-28t01:52:17.864z http/1.1 401 unauthorized cache-control: no-cache pragma: no-cache expires: -1 server: microsoft-iis/10.0 x-content-type-options: nosniff www-authenticate: basic realm="service" x-sourcefiles: =?utf-8?b?yzpcdxnlcnnca2fsd2vfmdawxgrvy3vtzw50c1x2axn1ywwgc3r1zglvidiwmtncuhjvamvjdhncvgvzdfnpz25hbfiutw9iawxlu2vydmljzvxuzxn0u2lnbmfsui5nb2jpbgvtzxj2awnlxhnpz25hbhjcbmvnb3rpyxrl?= x-powered-by: asp.net date: fri, 19 jun 2015 04:32:28 gmt content-length: 0
the browser pops form asking basic authentication, have no username or password. running locally, there no azure application key.
how can disable or work around authentication requirement signalr hubs on azure mobile services?
have looked @ blog post? http://blogs.msdn.com/b/azuremobile/archive/2014/05/30/realtime-with-signalr-and-azure-mobile-net-backend.aspx
you can set authorization globally with:
public static void register() { // initialize signalr signalrextensionconfig.initialize(); // use class set configuration options mobile service configoptions options = new configoptions(); options.setrealtimeauthorization(authorizationlevel.anonymous); ... }
Comments
Post a Comment