Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

firebase + facebook Open Graph

(I am creating a new question cause it will be easy for others to find it)

have got the login to work with firebase. trying to get access to the open graph data on the client side itself.

I have the user access Token thanks to the firebase sdk. Now I have permission to get access to the user likes.

(I have never used FB open graph before and all the examples are done using the FBphp sdk)

            var myDataRef = new Firebase('my firebase');
            var temp;           
            var authClient = new FirebaseAuthClient(myDataRef, function(error, user) {
                if (error) {
                    // an error occurred while attempting login
                    console.log('an error occurred:');
                    console.log(error);
                } else if (user) {
                    // user authenticated with Firebase
                    console.log('logged in:');
                    console.log(user.accessToken);
                    temp=user.accessToken;

    /*look here*/   $.getJSON('https://graph.facebook.com/'+ user.id +'/likes?access_token='+temp+'', function(data) {
                    console.log("Data Loaded: " + data);

                 } else {
                       // user is logged out
                       console.log('logged out');
                 }
            });

The request is successful but the data returned is not being displayed, all I am getting is [Object object] in console. Any help will be appreciated

like image 258
tussh13 Avatar asked Aug 09 '26 07:08

tussh13


1 Answers

It looks like you actually are getting some useful data back, but console.log("Data Loaded: " + data); is converting that data to the string [Object object]

To see the contents of your data, try logging with this instead: console.log(data) or use a breakpoint in your developer tools to inspect it during runtime.

like image 139
mimming Avatar answered Aug 12 '26 00:08

mimming