0

I've tried and tried to get Open Graph to work on my own without any luck. I've also tried alternative options such as ajax call works in Chrome, Firefox but not in IE?, but that has serious issues.

What I would like is a complete solution for using Open Graph to retrieve all wall posts given a specified Facebook profile ID. It needs to get the access token without having the user login to facebook. edit: I have an application with an App ID and App Secret. Shouldn't I be able to use this to get the Access_token? I want users without a facebook account to be able to see the wall posts of this kids page (that's kind of the whole point of building a separate site).

For what it's worth, this is for a site for a kid with a terminal brain tumor... which kind of leaves me in a position where I can't make demands (like spend $50 on an SSL or "just use facebook").

edit I think the only thing I need is to get the access_token. This can't be that difficult.

Community
  • 1
  • 1
  • 3
    Could you be more specific about what kind of code you have already tried? You say that you have tried without luck, what have you tried? – Mosselman Apr 08 '12 at 23:03
  • Please post your code. It's difficult to fix a car without being able to look under the hood :) – jamesmortensen Apr 08 '12 at 23:04
  • I didn't keep versions of everything I tried. For the most recent revision you can view the question I linked in the OP. Sorry. As for the car analogy, send me a picture of the engine compartment... –  Apr 09 '12 at 01:06
  • Here is another post I made about the subject in which I had it fully working (except for the IE issue) http://stackoverflow.com/questions/10058564/jquery-rss-atom-feed-jfeed-origin-issue-origin-xxxxx-is-not-allowed-by-access/10065431#10065431 (see my answer) –  Apr 09 '12 at 01:09
  • @ScottBeeson: Send me a message via http://getwellgabby.org/comments and mark it as "For Chris." I'll create a php page to return a json feed for you. – cpilko Apr 27 '12 at 16:04
  • 1
    You need permission granted by the user to get an access token. An app id alone is not enough to get an access token. If it was, then nothing on Facebook would be "private" and anyone could see everything. If the user would like to share their wall more publicly, then they should change their privacy settings accordingly. – Nick Clark Apr 29 '12 at 06:06
  • If the page has public post, one doesn't need Facebook account to just view them. Wouldn't that solve it? – webjunkie Apr 30 '12 at 10:51
  • Would it be a valid option to use chrome frame in order to use webkit in IE? I have no IE available right now, so I sadly can't help test this for you. Also, as stated by @jmort253 before, we can't really help without any code. – Mosselman Apr 30 '12 at 15:01

4 Answers4

2

  • NOTE: this answer both your questions and peraph someone should close at least one of them

so my solution to this problem is simple; you still continue to use AJAX to perform the request to facebook but not directly.

so your code will look something like this:

        $(function() {
            $.ajax({
                url : 'ajax-handler.php',
                data : 'action=get_access_token',
                type : 'GET',
                dataType : 'json',
                success : function(json) {

                }
            });
        });

then on the ajax-handler.php file you will put all the stuff needed to retrieve the access_token and other information.

a server-side pseudo code (i'm using php here) will look something like this, but you need to use the php sdk for a better coding...

<?php
$action = $_GET['action'];
if (isset($action)) {
    switch($action) {
        case 'get_access_token' :
            $query = array('client_id' => '####', 'client_secret' => '####', 'grant_type' => 'client_credentials');

            $access_token = file_get_contents('https://graph.facebook.com/oauth/access_token?' . http_build_query($query));

            //$access_token will be like access_token=asdas8dd98sada...
            //but we don't use it here...

            $app =   file_get_contents('https://graph.facebook.com/######');

            echo $app;
            break;
    }
}
?>

and this is the result:

Luca Filosofi
  • 30,905
  • 9
  • 70
  • 77
  • I'm not using PHP... I use ASP.net. But you're saying getting the access_token from ANY server-side call should work? –  May 01 '12 at 14:58
  • @Scott Beeson: it simply can't fails. you are doing something wrong. – Luca Filosofi May 01 '12 at 15:09
  • And can you answer the question in my first comment? –  May 02 '12 at 20:46
  • I finally got this working by calling a .net web service from my javascript via ajax. Thanks for pointing me in the right direction. –  May 05 '12 at 19:30
1

I do not have a turn-key solution (sorry not enough time), but I can offer a way to get around cross-domain requests:

easyXDM is a Javascript library that enables you as a developer to easily work around the limitation set in place by the Same Origin Policy, in turn making it easy to communicate and expose javascript API’s across domain boundaries.

Example: http://easyxdm.net/wp/2010/03/17/cross-domain-ajax/

tomByrer
  • 1,105
  • 12
  • 21
0

Is your facebook account friends with his account? If so, you can generate your own access token for your own account and view the kid's feed using your own token using https://graph.facebook.com/id-or-alias/feed

yincrash
  • 6,394
  • 1
  • 39
  • 41
-1

Only public data on the Graph can be accessed without a valid Access Token. A list of these available public arrays can be found here. A user's wall post's can be viewed using the /me/feed API Call, but this action specifically requires an access token.

Ryan Brodie
  • 6,554
  • 8
  • 40
  • 57