Facebook Oauth2.0 API Call method

Source: Internet
Author: User
Tags call back oauth

These days with the Facebook API, the official website to get some of the interface, the following simple to call the Facebook process and the common Interface book order:-)

Of course, before you use the Facebook API, you have to have a Facebook account and register your app on Facebook.
1. Login Authentication
Https://graph.facebook.com/oauth/authorize?client_id=8888888888888&redirect_uri=http://www.mywebsite.com &scope=user_about_me,user_activities,user_birthday,user_education_history,user_events,user_groups,user_ Hometown,user_interests,user_likes,user_location,user_notes,user_online_presence,user_photo_video_tags,user_ Photos,user_relationships,user_religion_politics,user_status,user_videos,user_website,user_work_history,read_ Friendlists,read_requests,publish_stream,create_event,rsvp_event,sms,offline_access,friends_about_me,friends_ Activities,friends_birthday,friends_education_history,friends_events,friends_groups,friends_hometown,friends_ Interests,friends_likes,friends_location,friends_notes,friends_online_presence,friends_photo_video_tags, Friends_photos,friends_relationships,friends_religion_politics,friends_status,friends_videos,friends_website, Friends_work_history,read_stream,photo_upload
Field Description: client_id: After registering the app you can get
Redirect_uri: Login Authentication Callback Page
Scope: Facebook module that allows users to access it (available on the official website)

Login authentication will call back to your given Redirect_uri, which will be followed by your URL with a given result parameter on Facebook, where Auth_token is what we need below
2. Access to authentication signs

https://graph.facebook.com/oauth/access_token?client_id=8888888888888&redirect_uri=http:// Www.mywebsite.com&client_secret=3dfdsa5425fdsa7554520720df8&code= .......

Field Description: client_id: After registering the app you can get
Redirect_uri: Callback Page

Client_secret: After registering the app you can get
Code: Auth_token value returned after login authentication

Here the interface will be similar to the first step to return to us a Access_token value, below we need to use this Access_token value to do the following (Access_token value can be stored, the next time to continue to use):
A. Querying personal information
Https://graph.facebook.com/me?access_token= ... Note: "Me" can be replaced by any user ID.
You can add the fields parameter to query the corresponding personal information field, with the following field set:
Fields=id,name,first_name,middle_name,last_name,gender,locale,languages,link,username,third_party_id,timezone, Updated_time,verified,bio,birthday,education,email,hometown,interested_in,location,political,favorite_athletes    , Favorite_teams,quotes,relationship_status,religion,significant_other,video_upload_limits,website,work,picture User-defined images can also be obtained as follows:
Https://graph.facebook.com/me/picture?access_token= ...
B. Find Friends
Https://graph.facebook.com/me/friends?access_token= ...    Note: "Me" can be replaced by any user ID. Or it can be in fql form:
Https://graph.facebook.com/fql?q=SELECT Uid2 from friend WHERE Uid2 = Me ()
C. Querying personal news information
Https://graph.facebook.com/me/feed?access_token= ...    Note: "Me" can be replaced by any user ID. Or it can be in fql form:
Https://graph.facebook.com/fql?q=SELECT status_id, time, source, message from status where uid = Me () &access_token= ...
D. Querying all the user's dynamic information (including their own/friends/systems) https://graph.facebook.com/me/home?access_token= ...    Note: "Me" can be replaced by any user ID. Or it can be in fql form:
Https://graph.facebook.com/fql?q=SELECT%20status_id,%20time,%20source,%20message%20FROM%20status%20where%20uid %20in%20%28select%20uid1,%20uid2%20from%20friend%20where%20uid1%20=%20me%28%29%29&access_token= ...
E. Publishing News
Need to be submitted by post, URL: https://graph.facebook.com/me/feed/
The parameters are:
Message = "Add News Feed Test!!!"; Access_token = "...";

Here are some of the more commonly used interface offers, Facebook official development document address:

http://developers.facebook.com/docs/reference/api/
All of the interfaces provided by Facebook can be tested on the official browser tool (or directly assembled with the URL tested on FF to see the return effect, and may be prompted for download on IE):
Official Browser tool Address: Http://developers.facebook.com/tools/explorer
The official forum is also good: http://stackoverflow.com
Twitter API call Example: http://download.csdn.net/detail/dingding5060/3715744

Facebook Oauth2.0 API Call method

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.