Enabling SIgnalR Authentication Against Azure Mobile Services and Javascript Client

I'm having a heck of a time trying to figure out how AMS authentication with SignalR is supposed to be when using a JavaScript client.

I downloaded the JavaScript client for Azure Mobile Services, I have Signal R on AMS - everything is connected and ready to go. I have an authentication setup.

I can actually call .login ("microsoftaccount") on the AMS JS client and go through the process and return the token and id.

I don't know how to connect these two.

I tried just calling $ .connection.hub.Start () - it gives me 401. I tried to put the token in the query string, again it gives me 401. I had to somehow call the login function via SignalR

The documentation for SignalR and AMS is heavily lacking, but does anyone know where there might be some explanation of how this should work? JavaScript client with SignalR, I mean.

thank

+3


source to share


1 answer


The client.currentUser object has a token defined in it - this is a standard JWT. Then add the X-ZUMO-AUTH header with the JWT value to the connection request. This will authenticate the request with the ASP.NET application.



A good resource is 12 Days ZUMO: http://www.thejoyofcode.com/The_twelve_days_of_ZUMO.aspx

0


source







All Articles