Topic-icon Additional Permissions Request problem

Active Subscriptions:

None
11 years 4 weeks ago #32186 by 7of9
Hi,

Although , although user_birthday & user_about_me are set in Additional Permissions Request, PHP API does not return birthday & bio.

Please advice.

Kind regards,

Manos
The topic has been locked.
Support Specialist
11 years 4 weeks ago #32190 by alzander
What extension are you trying to pull that information into? You should need to add the user_birthday or user_about_me permissions manually to JFBConnect, those should be automatically determined when you configure the Social Profile plugin(s) to import that data.

Let me know a little more about your configuration, and we'll help how we can.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
11 years 4 weeks ago #32197 by 7of9
Hi,

I am not using any extension to import the information into. Just PHP code.
// Create Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
'appId' => 'I use my appid here',
'secret' => 'I use my secret here',
'cookie' => true
));
//Get user profile details
$user_profile = $facebook->api($_POST["fbid"],'GET');
echo "Bio: " . $user_profile."";
echo "Birthday: " . $user_profile."";

Any other information I try to access, like this, ie likes, gender, locale, works fine. However these two information fields return empty, although, I have added the permissions in Additional Permissions Request of JFBConnect component.
ie:
echo "Locale: " . $user_profile."";

works fine.

Thanks in advance.
The topic has been locked.
Support Specialist
11 years 4 weeks ago #32210 by alzander
Can you test on the Facebook debugger site and see if the data comes in properly?
developers.facebook.com/tools/explorer?method=GET&path=me

Or, for a specific field:
developers.facebook.com/tools/explorer?m...th=me%3Ffields%3Dbio

Let me know if that works. If not, it's likely an indication that that field either doesn't exist in your profile or is set to be private.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
11 years 4 weeks ago #32214 by 7of9
Hi Alex,

Bio displays correctly. However birthday is not displayed at all. (My birthday is set to be displayed without the year in facebook)
Those pages however use an access token, not an app. Since in my app I have clearly given the right to access those fields, shouldn't that info be available, regardless if it's private or not?

Thanks in advance.

Kind regards,

Manos
The topic has been locked.
Support Specialist
11 years 3 weeks ago #32217 by alzander
There's 2 options for the authentication token to test with:
* In the top right of the debugger, use the "Application:" drop down to select your application.. then click the "Get Access Token" button. You can set the permissions there, but they should already be defaulted to what you've granted for your app.
* You can look in the xyz_jfbconnect_user_map table for your user and pull the access token from there to test with. Copy it and paste it into the debugger Access Token field.

Test with that and let us know if you can get the right information from there. Beyond that, I'm not sure why you can't get those fields. When we're developing, we always explicitly state the fields we want to fetch instead of trying to get the whole profile. That may be something you also want to try instead of the generic call you're using.

Keep me posted on how the tests go.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
11 years 3 weeks ago #32224 by 7of9
Hi Alex,

Yes, that way I get the information. However, I should not require an Access Token in order to get this information, according to the FB API, should I?
So far I have not used an Access Token in my code. How do I use it?

Thanks again!
The topic has been locked.
Support Specialist
11 years 3 weeks ago #32236 by alzander
As far as I know, the permissions are always required for birthday. Not sure about bio offhand honestly.

I just re-looked at your code and would highly recommend updating it a bit to use JFBConnect more. You're re-instantiating the Facebook library (which is slower) and avoiding a lot of great functionality in JFBConnect. If you're up for a minor update of your code, I'd recommend changing it to the following:
$profileLibrary = JFBConnectProfileLibrary::getInstance();
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
$fbUserId = $jfbcLibrary->getFbUserId(); // This is the current user logged in through Facebook
$fbUser = $profileLibrary->fetchProfile($fbUserId, array('bio', 'locale', 'birthday'));
$bio = $fbUser->get('bio', ''); // default of 'blank' in case nothing is returned
$locale = $fbUser->get('locale', 'en_GB'); // default of 'en_GB'
...
That will use JFBConnect to fetch the information. The benefits are that you have error checking, a lot of checks in the code, and you can easily set a default in case nothing comes back. It also will use the user's current authentication token, which should have the permissions they granted on login.

Hope that all helps, but if not, let me know!

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
11 years 3 weeks ago #32242 by 7of9
Hi Alex,

Thanks for the help. What I need is a code to read all users' information who have subscribed using JFB, in my site, according to the permissions my app allows and are set in JFB.

Thanks in advance.
The topic has been locked.
Support Specialist
11 years 3 weeks ago #32273 by alzander
There isn't a way to query Facebook for 'any available data'. The query you were originally doing with the just a "GET" call gets the basic profile information about a user. You'd need to specifically query Facebook for the fields you want to get. To our knowledge, you can't say "Get me all data that the user has approved", you have to specifically query for each of those extended fields. You can even query for fields you don't have permission for, you'll just get a blank response.

Sorry I don't have any better answers, but querying for the specific fields you want will also minimize traffic to Facebook and their responses, which can speed up the overall process as well.

I hope that helps,
Alex
The topic has been locked.