Get Facebook User ID from app-scoped User ID

With the upgrade from Facebook Graph API v1.0 to v2.0, Facebook is using "App-scoped User IDs", so I cannot see the "original" user ID inside my apps anymore.

I always used the Real Time Updates and graph API calls like "{postId}/comments" to analyze user activity on the Facebook page where the app was. But since these data contain the original user ID, I'm not able to match the activities to my registered users anymore!

So is there a way to get the original Facebook user ID from an app-scoped user ID? Or the other way round?


I ended up fetching the app-scoped IDs for all my users using the API method mentioned here: and stored them in my database in addition to the old ID. Then, whenever an RTU arrived, for "old users" I would check which user has this app-scoped ID and process the update. At least Facebook managed to fix the bug mentioned in the comments (Get Facebook User ID from app-scoped User ID) a few days before the API v1.0 was deprecated, so for new users of my apps, it works like a charm. So far...


there's no (simple/obvious) possibility to get a real user id based on an app-scoped user id.

From your conversation between Johannes N.

Can I get the app-scoped ids (for apps I own) via the original user id. that would help too.

To get app-scoped ids from original user id can be easily done via:

Yo can use fields parameter to return only id:

The benefit of ids instead of id because you can query multiple ids:

*www can be remove to minimize characters count.

To get app-scoped ids from username can be easily done too:

You can't go from scoped back to real. Your best bet is converting all of them to scoped. It's pretty easy:|APP_SECRET

Here's some simple Ruby code that does this:

require 'open-uri'
require 'json'

json = JSON.load(open("{real_id}&access_token=#{FACEBOOK_APP_ID}|#{FACEBOOK_APP_SECRET}"))
scoped_id = /app_scoped_user_id\/(\d+)\//.match(json[real_id.to_s]['link'])[1]

I found a website can help you get facebook user id from app scoped id.

It's here


there is a dirty hack to retrieve original user id this returns the facebook public information as follows, { "id": "app-scoped-id", "first_name": "xxxx", "gender": "male", "last_name": "yyyy", "link": "", "locale": "en_US", "name": "xxxx yyyy", "username": "zzzz" }

Then you make another graph api call with username

This will returns the original facebook id and other public information, instead of app-scoped-id

ask yourself why derive from this link username everyone.

   "id": "670839443061245",
   "first_name": "Lucas",
   "gender": "male",
   "last_name": "Ou-Yang",
   "link": "",
   "locale": "en_US",
   "name": "Lucas Ou-Yang",
   "username": "L"

Need Your Help

How do I know if my server has NUMA?

linux jvm kernel processor numa

Hopping from Java Garbage Collection, I came across JVM settings for NUMA. Curiously I wanted to check if my CentOS server has NUMA capabilities or not. Is there a *ix command or utility that could...