views:

354

answers:

3

Hello!

Facebook apps are allowed to have a tab that a user can add to his profile's tabs if he wants.

How can I get the uid or otherwise identify the currently logged in user in order to customize the layout for him please?

Thank you.

+3  A: 

As noted here:

Facebook does not pass back who the viewing user is when she first visits your tab. Facebook does send the profile owner's ID in the fb_sig_profile_user parameter, so you know whose profile to display content for.

Visitor id is passed as request parameter after a user interacts with your tab. I can't find exact parameter name as they removed a wiki page that used to contain a list of all passed parameters, but if you dump all your request vars you should be able to see it (but not during the first visit).

serg
Francisc
Just to make sure: if the link isn't visible, it shows a map with cities visited by the user who has that tab in his profile.How do they do that? If I had the FB ID of the user who has that tab it would be simple...
Francisc
@Francisc if you need profile owner id then just read `fb_sig_profile_user` request parameter on your server side. You can get owner id, just not the visitor.
serg
Excellent! That's exactly what I wanted.Thanks a lot, Serg!
Francisc
+1  A: 

some sources to do it + you must have turned on all items on migration in app settings

http://nathrondevblog.blogspot.com/2010/09/how-to-get-user-id-in-profile-tab.html

grexos
+1  A: 

Try out this one, If the user is logged in. You can directly get the user_id, session_key etc from the querystring.

       long fbuid = long.Parse(Request.QueryString.Get("fb_sig_user"));
Adi_aks