Facebook Get User ID From Application Tab

故事扮演 提交于 2019-12-23 21:14:57

问题


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.


回答1:


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




回答2:


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




回答3:


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"));


来源:https://stackoverflow.com/questions/3504943/facebook-get-user-id-from-application-tab

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!