Leo Jiang
Leo Jiang

Reputation: 26075

Get Facebook profile URL from app-scoped user ID

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?

Upvotes: 4

Views: 13142

Answers (4)

manhhaiphp
manhhaiphp

Reputation: 121

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

Upvotes: 2

Boon Kgim
Boon Kgim

Reputation: 66

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...

Upvotes: 1

DQM
DQM

Reputation: 552

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. :(

Upvotes: 2

Tobi
Tobi

Reputation: 31479

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}/

Upvotes: 7

Related Questions