0

i'm currently trying to get all birthday dates from my Facebook friends, this is my current approach:

import facebook

app_id = 'XXX'
app_secret = 'XXX'
token = facebook.get_app_access_token(app_id, app_secret)

fb = facebook.GraphAPI(token)
args = {'fields' : 'birthday,name' }
friends = fb.get_object("me/friends",**args)

print(friends)

which prints

facebook.GraphAPIError: An active access token must be used to query information about the current user.

this is expected as i found out this error is because i'm not using a usertoken.

So i temporarily changed the token line to contain a user token, which i created at:

https://developers.facebook.com/tools/explorer/

this then prints:

{'summary': {'total_count': 434}, 'data': []}

It appears to me that it can access all my friends (since i have 434 friends) but neither their birthdays nor their names.

Anyone has an Idea what's going on and what i may do to reach my goal?

Lyux
  • 453
  • 1
  • 10
  • 22
  • You can not get “all” friends, only those that are users of your app as well, see https://stackoverflow.com/q/23417356/1427878 And you can only get the birthday of the current user of your app, not of their friends. Every user you want the birthday from, would have to log in to your app and grant it permission. – CBroe Aug 07 '17 at 07:48
  • I don't understand why this isn't possible, when i log in to fb, i can see all of my friends birthdays, when i authenticate against the API endpoint i can't? That makes zero sense to me. – Lyux Aug 07 '17 at 08:15
  • Because it is something completely different of course, whether you as my friend can see my data via the UI, or if any shady app you might be using gets their hands on my data. – CBroe Aug 07 '17 at 08:18
  • So how would i go about getting your data if we are friends? Because ultimately, that is what i want to do, getting the Birthdays of my friends, not some sort of strangers. – Lyux Aug 07 '17 at 08:19
  • it is not possible. – andyrandy Aug 07 '17 at 08:37
  • @luschn this is probably the worst awnser to give as and to a programmer. – Lyux Aug 07 '17 at 10:11
  • it is the only correct answer though ;) - the rest is in the duplicate thread, because that question has been asked a LOT already. in other words, you can only access the birthday of people who authorized your app with the user_birthday permission. it would be weird if you could get birthdays of friends who did NOT authorized the app with that permission, or did not even use the app in any way. – andyrandy Aug 07 '17 at 11:01

0 Answers0