4

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?

Kjensen
  • 12,447
  • 36
  • 109
  • 171

3 Answers3

2

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

AVH
  • 1,725
  • 1
  • 13
  • 8
1

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.

Community
  • 1
  • 1
Kjensen
  • 12,447
  • 36
  • 109
  • 171
0

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

nikib3ro
  • 20,366
  • 24
  • 120
  • 181