Retrieve public page content from Facebook without user login

Abstract

Facebook upgraded it’s API, cause some issue on our social micro page in our company. The public page content can not be retrieved anymore without creating an application, and I have to spend one day to look through the new method for retrieving content from public page of our company. At first I was every confusing with facebook’s access token,  variant access token corresponding to different approaches. Now, let me note down the main steps for this upgrading.

Step 1:
Create a new application on https://developers.facebook.com/, then you have the App ID and App Secret like below.

facebook-app

Step 2:
Insert Facebook Javascript SDK  in your page:

Pay attention to the parameter appId , it’s value should be your App ID that assigned by Facebook. Now the facebook SDK initialed by above code.

Step3:
Get access token from facebook graphic API.

The variable token is what we want, use it to call facebook graph api to retrieve information without user login.

Step 4:
Access facebook graph api with access token

 

Put them all together

 

 

The following two tabs change content below.
Wang Weiqiang is a senior web developer, and professional on ASP.NET, MVC, C#, Python, SQL Server, HTML5, Javascript, also interesting in machine learning and related algorithm.

Latest posts by Wang Weiqiang (王维强) (see all)

Wang Weiqiang is a senior web developer, and professional on ASP.NET, MVC, C#, Python, SQL Server, HTML5, Javascript, also interesting in machine learning and related algorithm.

Posted in Javascript Tagged with: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Categories

Recent Posts

Related Posts