Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found this post <a href="http://facebooksdk.codeplex.com/discussions/244568" rel="nofollow">http://facebooksdk.codeplex.com/discussions/244568</a> on codeplex. I think this is what you need.</p> <p>Note that instead of using the client-side flow, you need to use the server-side flow. </p> <p>This is what you should do</p> <p>Create a login link for server-side flow. After Authorization, facebook will return an url containing a code instead of a access token.</p> <p>Then you request for a token from facebook using the code. this is my example</p> <pre><code> public ActionResult FBAuthorize() { FacebookOAuthClient cl = new FacebookOAuthClient(FacebookContext.Current); FacebookOAuthResult result = null; string url = Request.Url.OriginalString; // verify that there is a code in the url if (FacebookOAuthResult.TryParse(url, out result)) { if (result.IsSuccess) { string code = result.Code; // this line is necessary till they fix a bug *see details below cl.RedirectUri = new UriBuilder("http://localhost:5000/account/FBAuthorize").Uri; var parameters = new Dictionary&lt;string, object&gt;(); //parameters.Add("permissions", "offline_access"); Dictionary&lt;String, Object&gt; dict = (Dictionary&lt;String, Object&gt;)cl.ExchangeCodeForAccessToken(code, new Dictionary&lt;string, object&gt; { { "redirect_uri", "http://localhost:5000/account/FBAuthorize" } }); Object Token = dict.Values.ElementAt(0); TempData["accessToken"] = Token.ToString(); return RedirectToAction ("ShowUser"); } else { var errorDescription = result.ErrorDescription; } } else { // TODO: handle error } return View(); } </code></pre> <p>*There is bug when using IIS in localhost, see the original post for details (the redirect uri when asking for the token must be the same as the one used asking for the code)</p> <p>It is highly recommended to use IIS and not visual studio web server. There are many things that wont work in visual studio web server.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload