Facebook application development 2 get user information

Source: Internet
Author: User
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 " );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.