Reputation: 4106
If you have a Facebook, for instance Zuckerbergs user id '4', or username, 'zuck', how do you get the new app-scoped id with Graph v2.0
using the app's access token? Can't seem to find anything about this in the docs.
Upvotes: 7
Views: 9189
Reputation: 121
You also get real facebook id from app scoped user id. Solution here https://stackoverflow.com/a/34450491/2181069
Upvotes: -2
Reputation: 784
In addition to the comment by @Raymond Yee, you have to provide APP_ID
, APP_SECRET
and FACEBOOK_USER_ID
(note that this is the numeric id, not the username):
So it works with this URL:
https://graph.facebook.com/v2.3?access_token=[APP_ID]%7C[APP_SECRET]&ids=[FACEBOOK_USER_ID]
Upvotes: 1
Reputation: 4106
This is basically the answer given to the other-way-around question, Get Facebook User ID from app-scoped User ID .
Basically, easiest straight forward flow is a call to https://graph.facebook.com/?ids=http://facebook.com/[FBID/USERNAME]&access_token=[APP_ID]|[APP_SECRET]
Doing that for Zuckerberg, will give you the familiar
{
"http://facebook.com/4":
{
"id": "4",
"first_name": "Mark",
"gender": "male",
"last_name": "Zuckerberg",
"link": "https://www.facebook.com/zuck",
"locale": "en_US",
"name": "Mark Zuckerberg",
"username": "zuck"
}
}
But, if that user had only logged in to your app for the first time after 30th May 2014 (the changeover date), he'd have something like...
{
"http://facebook.com/4":
{
"id": "277123456789101",
"first_name": "Mark",
"gender": "male",
"last_name": "Zuckerberg",
"link": "https://www.facebook.com/zuck",
"locale": "en_US",
"name": "Mark Zuckerberg",
"username": "zuck"
}
}
Giving you the 277... app-scoped id for your app.
Upvotes: 3