dtp791357 2010-07-23 04:40
浏览 74
已采纳

如何在Facebook iframe应用程序中获取Facebook用户的用户ID?

I'm developing a Facebook iframe/Facebook Connect application with PHP client library. In my index page, I check if the user is logged in by using require_login().

 $user_id = $facebook->require_login($required_permissions = 'user_location,publish_stream,email,read_stream,user_about_me,user_activities,user_birthday,user_events,user_groups,

user_hometown,user_interests,user_likes,user_status,user_photos);

Thus I get the $user_id of the user in that page. But in the subsequent pages, If I use require_login() to get the user_id, some prablem occurs and the page ie not redirected. The page gets refreshing and nothing is displayed.

So I tried using $user_id = $facebook->get_loggedin_user(); but then I dont get the user id in the variable.

If I use $user_id = $_GET[fb_sig_user]; , sometimes I get the value, sometimes I dont. Please suggest me the proper method to get the user_id in other pages too.

  • 写回答

1条回答 默认 最新

  • dongzhanjuan5141 2010-07-23 05:47
    关注

    I have found the answer. Posting it so that it might help someone else ..

    Adding $facebook->require_frame(); before using the $user_id = $facebook->require_login() syntax in the main page and the $user_id = $facebook->get_loggedin_user(); in the other pages, solves the problem.

    For more details refer to this thread: http://forum.developers.facebook.com/viewtopic.php?pid=218858

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序