For canvas application, the user ID that I can obtained in the current user accessing the application. This is the same for application tab. But I need to get the profile owner user ID (i.e. the user who had added the application to his/her user profile). How can I do this?




Appreciate if you can like this page if you find it useful! - Click "Like"

If you are using the Old PHP client library, the easiest way to get the profile user ID is by calling the following method:

profile_owner_uid = $facebook->get_profile_user();


In you are using the PHP SDK or any other SDKs, the get_profile_user us probably not available anymore.

Having said that, it is not that difficult to get the profile owner user ID. It is stored as part of the $_REQUEST object. However, it is stored under different names in different situation.

  • When the application tab is being loaded, the profile owner user ID is stored as "fb_sig_profile_user" in the $_REQEUST object.

  • When the viewing user interacts with the tab (e.g. when the user submits a form), the profile owner user ID is stored as "fb_sig_profile" in the $_REQUEST object.

However, please note that in order to have the above fb_sig_* elements available in the $_REQUEST object, you have to disable the "New SDKs" option on the "Migrations" tab of the application settings. Well, with the "New SDKs" option disable, we may not be able to use of some features in those NEW SDKs. Facebook is currently working on a fix for this already.

** updated on 25Jul2010: the "New SDKs" option has been renamed as "Canvas Session Parameter" recently.



Find my FAQ on Facebook Development useful? Download the PDF for all the FAQs HERE!