简体   繁体   中英

Get “real” profile URL from Facebook Graph API /user

As stated in the API docs for /user , the link field contains the user's profile URL. However, this URL commonly redirects to a different URL (ie the one that shows up in Google results).

Is there any way to determine the final redirect location (the "real" URL) of a given profile via the Facebook API?

For example, given:

"link":"https://www.facebook.com/1091552020"

I want to retrieve https://www.facebook.com/sbhutiani from the API

You can´t get the real ID or the username of users anymore, so there is no way to get the "real URL". More information: https://developers.facebook.com/docs/apps/changelog

You can get a link to the user profile with the following API call though: /me?fields=link

Check out "App Scoped IDs" in the Facebook docs.

Update: It seems that linking to the user profile is not possible anymore: https://developers.facebook.com/blog/post/2018/04/19/facebook-login-changes-address-abuse/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM