简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM