Facebook C # SDK - Server Stream Authentication

I use the Facebook C # SDK installed using NuGet so that a user can log in to my site using Facebook. In all the C # SDK documentation I found, the access token was obtained using the JavaScript SDK. I want to make an entire authentication server server without using the JavaScript SDK.

  • Where can I find good documentation or sample code for the steps that I need to complete for a full server side validation using the Facebook C # SDK?

  • Is there any advantage in combining SDK SDK and JavaScript SDK, or is it great to stick to only server-side stream?

+6
source share
2 answers

Authentication on the server side is the same as on the client side, you redirect the user to OAuth Dialog with parameters such as RedirectUri and your AppId. Then the user is redirected to RedirectUri using the parameter code, and now you make a server-side request to convert the code to access the token, that's all.

Read the server-side authentication document at http://developers.facebook.com/docs/authentication/server-side/

How to exchange code for user access token using Facebook C # SDK?

var fb = new FacebookClient(); dynamic response = fb.Get("oauth/access_token", new { client_id = APP_ID, redirect_uri = "http://www.example.com/", client_secret = SECRET_ID, code = CODE }) //response.access_token //response.expires 
+6
source

var fb = new FacebookClient (); dynamic signedRequest = fb.ParseSignedRequest ("app_secret", Request.Params ["signed_request"]);

0
source

Source: https://habr.com/ru/post/919521/


All Articles