FB: Retrieving (limited) user info

08-Oct-2015 11:03:50

Hi I am testing the Facebook login and after the call back for storing users information I only always get the name and id not the whole public profile which include first name, last name and so on, then I research about the problem and I got this.

"An active access token must be used to query information about the current user.",

How could I add that to your plugin?


10-Oct-2015 14:09:43


If you want to edit the Facebook login you can try to edit "facebook.php" file in "auth/platforms/facebook-app" folder.

In the file, if you want to ask special user data you can look for the line:

$loginUrl = $helper->getLoginUrl(array('email'));

In the code above, I set "email" parameter to request user email when users login. As I know, public profile is a default setting so we do not need to set it in this line.

or you can check this line:

$request = new FacebookRequest( $session, 'GET', '/me' );

to retrieve user data by Graph API.

I think the reason you got only User ID and Name is that Facebook Graph API did not respond full public profile. I see Facebook has updated their API recently but I am quite busy so I have not checked it. I will try to check it soon and update it (if needed).


14-Oct-2015 11:59:44

Hi Thanks for the reply, it is helpful.

Would you recommend to filter sanitize and validate those user profile that Facebook would send to my app? Or does Facebook already cleaned up all those info for clients?

15-Oct-2015 06:45:40

I think Facebook checked and validated user profiles so we do not need to do it again.