I’m building a small internal social media data sharing app.
A bunch of users log into my app(web page) and authorize my app to have access to their likes/profile information etc.
Later on, I want any of these users to see the other user’s information through a custom reporting app that i’ve built.
The last part works perfectly fine if the user is
a) Logged into facebook himself
b) Friends with the other user.
I had assumed that since they had all given my app access when logging in, i should be able to pull the details on demand for anyone using just my app id and the javascript sdk.
This is the code :
window.fbAsyncInit = function() {
FB.init({
appId : 'myappid',
});
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref =d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
function fbDetails()
{
var profilepic = "";
FB.api(
{
method: 'fql.query',
query: 'SELECT uid,name,pic,about_me,movies,tv,books,games,work,education,friend_count FROM user WHERE uid="userid which i store from the first login"'
},
function(response) {
Do some stuff here;
});
}
You can only get the current data of the user which is actively using your app. Getting the Data while the user is not logged in in your app requires the permission “offline_access” (deprecated). They changed the name and how its used, but try the facebook graph api explorer, you can test your request there.