4

A Facebook user's profile URL is http://facebook.com/USER_ID. However, with an app-scoped user ID, http://facebook.com/APP_SCOPED_USER_ID doesn't redirect to the user's profile page. How can I reach an user's profile page using just an app-scoped user ID?

Leo Jiang
  • 24,497
  • 49
  • 154
  • 284
  • If you are trying to determine whether an id is app scoped, user ids fall in the range [(id < 2200000000 || (id >= 100000000000000 && id <= 100099999989999)](https://github.com/facebookarchive/facebook-js-sdk/blob/deprecated/src/xfbml/helper.js#L37). App scoped user ids will fall outside of this range – Matthew Kolb Sep 28 '20 at 21:12

4 Answers4

7

Use the link field of the user object. This will look like the following:

https://www.facebook.com/app_scoped_user_id/{app_scoped_user_id}/
Tobi
  • 31,405
  • 8
  • 58
  • 90
  • 1
    This seems to only work for the user's own profile page. It's a 404 error for other users' profile pages. – Leo Jiang Jun 19 '14 at 17:06
  • 1
    Nevermind, I was using a test user so the link didn't work. Can someone confirm that `https://www.facebook.com/app_scoped_user_id/{app_scoped_user_id}/` works for all normal users? – Leo Jiang Jun 19 '14 at 17:46
  • 1
    Did you get it to work? I can't get the link to work, with test users or with normal users. – Tom Spee Sep 22 '14 at 12:05
  • 1
    I get a 404 for other users' profile pages. Can only use this link when logged in as me. – Greg Jun 23 '15 at 12:11
  • Where would you get the ids from? It definitely works using /me, and that is how it should be used.@Greg – Tobi Jun 23 '15 at 12:34
  • any luck about how to open profile of others by using scope id – Janardhan R Aug 01 '19 at 11:00
  • The possible reason is described [here](https://developers.facebook.com/docs/graph-api/reference/user/#parameters) where it says that link can only be resolved (i.e. redirected to profile page) if the user viewing this link is a friend of or is a person whose profile it is *"A link to the person's Timeline. The link will only resolve if the person clicking the link is logged into Facebook and is a friend of the person whose profile is being viewed."* – Ruslan Plastun May 19 '21 at 13:17
2

The URL - https://www.facebook.com/app_scoped_user_id/{app_scoped_user_id}/ - is access limited, only X request can be made on Y period of time from an account.

I did build a tool to crawl facebook's username base on app-scoped uid, by making a request to that scoped uid profile, I can parse the redirect header to find out the username.

The access limitation makes me suck. :(

DQM
  • 562
  • 3
  • 15
  • Is access limited by app_id or by ip? – bogdaniy Feb 17 '15 at 23:55
  • At that moment, It's limited by current account. Once the limit is reached, I have to switch to another account and it'll be fine. And as I'm no long working on that project, not sure how it works now. – DQM Feb 24 '15 at 01:10
2

You can use url format:

http://fb.com/app_scoped_user_id/{app_scoped_user_id}

example http://fb.com/app_scoped_user_id/10101640953722381

If you want to get real facebook id from app scoped user id: https://stackoverflow.com/a/34450491/2181069

Community
  • 1
  • 1
manhhaiphp
  • 123
  • 7
1

Tested that the above answer: https://www.facebook.com/app_scoped_user_id/{app_scoped_user_id}/ works for new user that connect to your app after migration.

As stated in FB documentation, existing connected users will continue to return the global ID. And it seems that https://www.facebook.com/app_scoped_user_id/{existing_user_global_id}/ won't work.

Thus, need to differentiate between existing and new user and use the global url (https://www.facebook.com/{user_global_id}) and app-scoped URL accordingly. Kind of tedious...

Boon Kgim
  • 56
  • 4
  • https://www.facebook.com\/{user_id} works for me with both scoped and global IDs. /app_scoped_user_id/{user_id} indeed only works for scoped IDs (returns an error when used with global ID), and /profile.php?id={user_id} only works with global IDs and not with scoped IDs. – Shinhan Jun 05 '15 at 11:07