OAuth的2 Owin不工作StackExchange.Redis SessionState会 [英] OAuth 2 Owin not working StackExchange.Redis SessionState

查看:112
本文介绍了OAuth的2 Owin不工作StackExchange.Redis SessionState会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个新的,新MVC5项目我迷上了外部的OAuth登录谷歌,影,微软等所有正按预期启动。

Starting with a fresh, new MVC5 Project I hooked up External OAuth Login with Google, Facebook Twitter, Microsoft etc. All is working as expected.

然后我添加了新的<一个href=\"http://blogs.msdn.com/b/webdev/archive/2014/05/12/announcing-asp-net-session-state-provider-for-redis-$p$pview-release.aspx\"相对=nofollow> ASP.NET会话状态提供了Redis的preVIEW发布并有工作。是啊!

I then added the new ASP.NET Session State Provider for Redis Preview Release and have it working. Yeah!

我很快就发现,在尝试使用任何的OAuth提供者不再登录正常工作。该谷歌和放大器; Facebook登录按钮调用Accont控制器上的ExternalLoginCallback(字符串RETURNURL),但去没有出路的。登录页面只是刷新。

I soon noticed that attempting to login using any of the OAuth providers no longer works properly. The Google & Facebook login buttons calls the ExternalLoginCallback(string returnUrl) on the Accont controller but goes nowhere. The login page simply refreshes.

在LinkedIn,Twitter和微软按钮所有直接用户的登录页面,但在返回到我的应用程序,他们返回到登录页面,没有用户被添加到系统中。

The LinkedIn, Twitter, and Microsoft buttons all direct the user to those login pages but when returned back to my application they return to the login page and no user is added to the system.

注释掉在我的web.config定制的sessionState条目返回的外部登录恢复正常。

Commenting out the custom sessionState entry in my web.config returns the external login back to normal.

同时考虑框架是黑盒给我,我不知道如何去歌厅这两个一起玩。

Considering both frameworks are black-boxes to me I am not sure how to go about geting these two to play together.

推荐答案

这帮助我准确的问题。

http://www.nsilverbullet.net/2014/06/24/tough-mvc-5-owin-external-authentication-issue/

基本上是:
必须有会话状态?在修改的AccountController:

basically: Must Have Session State? in AccountController modify:

    [AllowAnonymous]
    public ActionResult Login(string returnUrl)
    {
        //Ensure Session has at least one value
        Session["EnableExternalAuth"] = true; // <--------- This helped

        ViewBag.ReturnUrl = returnUrl;
        return View();
    }

有似乎与会话和外部登录供应商的问题。

There seem to be an issue with sessions and external login providers

这篇关于OAuth的2 Owin不工作StackExchange.Redis SessionState会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆