Facebook身份验证AuthenticationManager.GetExternalLoginInfoAsync()突然返回NULL

问题描述 投票:1回答:3
public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
        {


            var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
            if (loginInfo == null) { return RedirectToAction("Login"); }
            // Sign in the user with this external login provider if the user already has a login
            var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false);

所以在我的ExternalLoginCallback方法中,AuthenticationManager.GetExternalLoginInfoAsync()曾经工作得很好,然后突然几天前它不再做任何事情并返回NULL,导致整个“注册Facebook”进程被跳过,将用户重定向到登录页面。

我有一个单独的ASP.NET MVC5项目,我只是用Facebook Graph API来玩,当我回到它时(我在2周前离开它,注册/登录Facebook在这个项目上工作得很好)它有同样的问题,它返回null!将用户重定向到登录页面。

有可能我的Facebook应用程序有什么东西吗?或他们的API?我没有通过应用程序审查3次(在代码中有一些问题),把它放回到开发模式试图解决它现在它甚至没有达到上一个问题,它停在AuthenticationManager.GetExternalLoginInfoAsync()我无法理解什么继续,因为我上周没有这个问题。

这是ExternalLogin方法:

public ActionResult ExternalLogin(string provider, string returnUrl)
        {

            ControllerContext.HttpContext.Session.RemoveAll();

            return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }));
        }

我已经添加了ControllerContext.HttpContext.Session.RemoveAll();给我在stackoverflow上找到的建议,但它似乎没有做任何事情。

asp.net-mvc facebook authentication facebook-graph-api owin
3个回答
10
投票

不得不将Microsoft Owin软件包更新到3.1.0-rc1,现在它可以工作了。 (在包管理器的更新选项卡中包含“include prerelease”)


1
投票

Facebook的一方发生了变化,导致Facebook使用Azure应用服务认证/授权登录网络和移动应用程序停止工作。

现在有一个修补程序已推广到大多数站点。

https://social.msdn.microsoft.com/Forums/azure/en-US/397f6952-57bf-4c28-b383-6bba08d28f9a/facebook-login-failures-with-app-service-authentication-authorization?forum=windowsazurewebsitespreview


0
投票

尝试更新所有nuget包,这对我有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.