Facebook user ID. Which one?

2019-09-25 10:46发布

问题:

I'm very confused... I try to setup a a fql fan page query, and in my search, I found that my user have several ID... So which should I use ?

Maybe more explaination is needed ^^

  • The first userId that I found is 4101606156331 (https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=me%3Ffields%3Did%2Cname&version=v2.0)
  • The second one is 1768286839 (https://graph.facebook.com/chapit.nicolas)

Which is the correct one ? And Why there are two IDs ? (maybe more...)

Someone can confirm me that which is the right ID (260226614127613 or 320233158126958) is the right one for the page CodeRougeAuto ? Because I like this page but when I try to know if I like the page with fql in Graph explorer tool (with a active token) I got this :

SELECT uid 
FROM page_fan 
WHERE uid=UID AND page_id=PAGEID
  • 4101606156331 and 260226614127613 : empty response
  • 4101606156331 and 320233158126958 : empty response
  • 1768286839 and 260226614127613 : Error The global ID 1768286839 is not allowed. Please use the application specific ID instead
  • 1768286839 and 320233158126958 : Error The global ID 1768286839 is not allowed. Please use the application specific ID instead

Thank you for your precious help !

回答1:

What you see are the so-called global and app-scoped user_ids. If you're using v1.0 of the Graph API, the user_ids will be global. If you use v2.0 they will be app-scoped, as in your first example.

It's all in the docs: https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids