我正在使用MVC与Owin外部登录与Facebook。
Owin不会打开facebook登录,因为popup.It会将页面重定向到facebook。
我知道有一个选项可以让脸书登录打开,因为popup.We需要在网址中添加"&dialog=popup“。
对于OWIN,我没有这个选项。
有没有办法做到这一点?
发布于 2014-12-04 13:07:40
我也有同样的问题。在通读源代码后,我找到了一个解决方案:
基本上:您需要继续为Facebook创建一个身份验证提供程序。因此,创建一个继承自FacebookAuthenticationProvider的类。在这个类中,重写"ApplyRedirect“方法。让它看起来像这样:
public override void ApplyRedirect(FacebookApplyRedirectContext context)
{
context.Response.Redirect(context.RedirectUri + "&display=popup");
}现在只需将这个类与您的配置连接起来,如下所示:
app.UseFacebookAuthentication(new FacebookAuthenticationOptions
{
Provider = new **<the name of the class that you created>**()
// the rest of your configuration such as app ID and secret
});应该就是这样了!
https://stackoverflow.com/questions/25646055
复制相似问题