The following uses the Facebook C # SDK, an open-source project 1. there are two prerequisites for obtaining User Logon:. user Login (log on to your website, refer to development 1) B. the user allows you to read some of his information, which can be found in the permission table what permissions need to be applied for 2. applying for permission is very simple for example you need to read user like data and its key is user_like So redirect to https://www.facebook.com/dialog/oauth? Client_id = your app ID & redirect_uri = returnurl & scope = user_likes this page is from Facebook. He will ask the user whether to allow your application. Program Access to his data will be directed to redirect_uri after user consent .... 3. in C # code
Facebookwebclient Client= NewFacebookwebclient ();
VaR user=(Facebook. jsonobject) client. Get ("Me");
VaR userlikes=(Facebook. jsonobject) client. Get ("Me/likes");
You can also use the following Code Confirm Logon (some information can be obtained only after logon)
Facebook. Web. facebookwebauthorizer= NewFacebookwebauthorizer ();
If(A. Authorize ())
{
//Get token return a. session. accesstoken;
}
It is also very important that the interface that does not need to log on is to obtain the current permission list. If you do not have the permission, you can play redirection. Haha ~
facebookwebclient client = New facebookwebclient ();
var permissions = client. get ( " me/permissions " );