Facebook PopUp Login with Owin

馋奶兔 提交于 2020-01-01 19:13:17

问题


I'm using MVC with Owin external login with Facebook.

Owin doesn't open facebook login as popup.It redirects the page to facebook.

I know there is a option to make facebook login open as popup.We need to add the "&dialog=popup" in the URL.

I don't have this option with OWIN.

Is there any way to do that?


回答1:


I had the same problem. After reading though the source, I found a solution:

Basically: you need to go ahead and create an authentication provider for Facebook. So create a class that inherits from FacebookAuthenticationProvider. Within this class, override the "ApplyRedirect" method. Make it look something like:

public override void ApplyRedirect(FacebookApplyRedirectContext context)
{
    context.Response.Redirect(context.RedirectUri + "&display=popup");
}

Now simply wire this class up with your configuration, like so:

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
});

And that should be it!



来源:https://stackoverflow.com/questions/25646055/facebook-popup-login-with-owin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!