Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR ASP.NET MVC5 Identity

i am trying to make SignalR work using ASP.NET Identity. The code is very simple, where we create a new MVC5 Web Application, enable Google Account External, login with google account and make request to the Hub recognize the user by calling:

Context.User.Identity

Anyway, this is always returning null and it seems the client proxy is not able to send the external cookie.

The only workaround is doing the same steps as stated here:

http://gobbe.net/2013/06/13/use-the-asp-net-membership-in-a-signalr-chat-with-an-asp-net-mvc-4-application/

The workaround works, but I would prefer to use another solution. I also checked https://github.com/gustavo-armenta/CookieAuthenticationSample but this is not using external authentication.

Do you have any other ideas on how the Hub can recognize the external authentication schema of ASP.NET Identity?

Thanks

like image 331
s s Avatar asked Jan 10 '14 15:01

s s


1 Answers

Ok. After hours of searching I went to jabbr online support and davidfowl helped out. The problem was the ordering of the calls on the Startup class. I had:

        app.MapSignalR();
        ConfigureAuth(app);

instead of:

        ConfigureAuth(app);
        app.MapSignalR();

Thanks David.

like image 126
s s Avatar answered Sep 27 '22 19:09

s s