Integrating facebook login and facebook c# SDK - NOT a facebook app

笑着哭i 提交于 2019-12-21 19:52:11

问题


I downloaded the samples and the 5.0.3 beta of the SDK, and pretty quickly got a facebook app up and running inside facebook - great and super easy.

However, I want to use facebook only as an authorization-mechanism, and I cannot figure out how to do that from the examples and documentation (actually I was unable to find any documentation apart from a few examples here and there).

I found this piece of code without context here: Link

protected void Page_Load(object sender, EventArgs e)
{
    if (!authorizer.IsAuthorized())
    {
        var authurl = authorizer.GetLoginUrl(new HttpRequestWrapper(Request));
        CanvasRedirect(authurl.ToString());
    }
    else
    {
        LoggedIn(); // function to call when the user is logged in to init the page
    }
}

This looks really interesting, but I cannot figure out what the authorizer is set up and used.

I am using MVC 3, but that should not really matter.

Is it possible to use the facebook c# sdk for this - and how?


回答1:


I had the same question and I found my answer here maybe this will help with what you're after: http://amirrajan.net/Blog/asp-mvc-and-facebook-single-sign-on




回答2:


DotNetOpenAuth CTP - Facebook bad request

The first answer there is good, with well-structured code with explanation, that I made work in a matter of minutes.




回答3:


Seems that you've resolved your problem, but in case somebody stumbles upon this question - I've found this new library pretty easy to understand from code:

OAuth2Login on GitHub

Also there is pretty detailed article that explains the library:

OAuth2 Social Logins - Facebook, Google, Twitter, PayPal - ASP.NET MVC C# open source library



来源:https://stackoverflow.com/questions/5047743/integrating-facebook-login-and-facebook-c-sharp-sdk-not-a-facebook-app

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