Facebook RSS feeds have stopped working

前端 未结 2 1807
醉酒成梦
醉酒成梦 2020-12-24 02:48

We are showing feeds from Facebook on our website. Until yesterday, we were able to retrieve the feeds in JSON format using the URL below:

https://www.facebo         


        
2条回答
  •  情话喂你
    2020-12-24 02:49

    Finally I was able to get the Facebook page feeds back on my website. Here goes the steps I followed to restore the feeds:

    Step 1: I logged into Facebook developer portal and created new Facebook Application (Website). You can find the details on how create a Facebook App from the following link: How to Create Facebook App

    On the newly created app you will find the "App ID" and "App Secret" values.

    Step 2: On my website, I used the "App ID" and "App Secret" to retrieve an "access_token" from Facebook. I used C#, so the line of code I used was:

    string access_token = "";
    try {
        access_token = webClient.DownloadString("https://graph.facebook.com/oauth/access_token?client_id=616255239999&client_secret=989898989898acec7c3aabbccddf84b66&grant_type=client_credentials");  
    }
    catch {}
    

    Replace client id with app id and client secret with app secret values copied from the previous step. If the values are correct you will get a response like:

    access_token=616255878567492343|UYgAYWXYztpFGRawnZ2VlTE
    

    Step 3: Now use the access token retrieved from the previous stage to call Facebook Graph API to get the feeds:

    string facebookjson = webClient.DownloadString("https://graph.facebook.com/v2.2/1730999949494/feed?access_token=616255878567492343|UYgAYWXYztpFGRawnZ2VlTE");
    

    The construct of the URL would like below:

    https://graph.facebook.com/v2.2/[your_facebook_page_id]/feed?access_token=[your_access_token_value]

    And voila!! You get the feeds from your Facebook page in a JSON response.

提交回复
热议问题