0

I'm using jFeed to try to retrieve a Facebook page's RSS feed. I can manually navigate to the RSS just fine (https://www.facebook.com/feeds/page.php?format=atom10&id=12345) but when I try to use the following code, I end up with the error "Origin xxxxx is not allowed by Access-Control-Allow-Origin."

jQuery.getFeed({
    url: 'https://www.facebook.com/feeds/page.php?format=atom10&id=12345',
    success: function (feed) {
        alert(feed.title);
    }
});

I'm assuming this is due to it requiring OAuth 2.0, but I really need a "silent" solution so people don't have to have a Facebook account or interact with Facebook in any way.

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112

2 Answers2

1

You might take a look at https://github.com/dawanda/jquery-rss. It's using google's feed API.

sdepold
  • 6,171
  • 2
  • 41
  • 47
0

Just got it working!!! I'm using the app ID and secret code to get the access_token and then using the jquery getJSON method to get the data. Works like a charm, no facebook auth required!!!

appID = '' //myappid
secretCode = '' //app "secret code"
authURL = 'https://graph.facebook.com/oauth/access_token?client_id=' + appID + '&client_secret=' + secretCode + '&grant_type=client_credentials'
feedURL = 'https://graph.facebook.com/' + appID + '/feed?'

function getFeed() {
    $.get(authURL, function (accessToken) {
        $.getJSON(feedURL + accessToken, function (data) {
            $.map(data.data, function (item) {
                alert(item.message);
                //type: status, photo
                //likes.count
                //from.name
                //created_time
            });
        });
    });
};

Obviously you'd want to do something besides "alert", but it works. Quite simple compared to anything else I've found.

  • FYI, this works great in Chrome and FF, but I run into cross-domain and security issues in IE. –  Apr 08 '12 at 23:03