dongmei9203 2013-12-31 21:25
浏览 16

迁移后,Facebook signed_request不会被退回

I've recently migrated our site to Amazon EC2 from another host. On the old server, our Facebook login worked fine, but it's failing on EC2. I've done some digging, and it looks like it's failing because no value is being passed back from Facebook for the signed_request variable. I've done print_r($_REQUEST) on my return page, and the only things Facebook is passing back is code and state, in the URL itself. Nothing in POST.

I did notice that the site URL defined in my app didn't have a slash at the end, which seems to be problematic based on some comments in this forum, but that didn't help. Other answers were from a couple of years ago, and seemed to be obsolete since I couldn't find what they were referring to.

I also tried adding my EC2 IP to my app's whitelist, and that didn't help either.

Here's my current code:

if(!session_start())session_start();

require_once("facebook.php");
require_once("config.php");

$facebook = new Facebook(array(  
  'appId'  => constant("FB_CONSUMER_KEY"),  
  'secret' => constant("FB_CONSUMER_SECRET"),  
  'cookie' => false  
));  

$FbId = intval($facebook->getUser());
if($FbId != 0) { 
   ...
} else {  
// log in to FB
    $login_url = $facebook->getLoginUrl(array(  
    'scope' => 'email,user_likes,publish_stream',  
    'next' => '<return_page>',  
    'cancel_url' => '<cancel_page>'  
    ));  

    exit;
}  

$FbId keeps coming back with a 0 value, even after logging into Facebook. Some digging showed that this is because the user is never being set in the getUserFromAvailableData function because $_REQUEST['signed_request'] doesn't have a value.

I've tried this both already logged into Facebook and not logged in, but $_REQUEST['signed_request'] isn't returned in either case.

I've seen some posts on here that indicate that old Facebook apps seem to have some kind of grandfathering where they continue to work until they get migrated, or another new app just like it gets created. Could that be the case here? Any help would be appreciated. Thanks,

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 运动想象脑电信号数据集.vhdr
    • ¥15 三因素重复测量数据R语句编写,不存在交互作用
    • ¥15 微信会员卡等级和折扣规则
    • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
    • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
    • ¥15 gdf格式的脑电数据如何处理matlab
    • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
    • ¥100 监控抖音用户作品更新可以微信公众号提醒
    • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
    • ¥70 2048小游戏毕设项目