drbxr86044 2012-10-25 09:34
浏览 95
已采纳

PHP-SDK有太多重定向

I'm using the PHP-SDK for Facebook and got the example to work on my localhost. However, when building a script on a server the script stays quite busy with redirecting from my script to facebook and back. (Error: Fout 310 (net::ERR_TOO_MANY_REDIRECTS):)

It seems that many more people have got this issue (here, here, here, here). Though, I can't find a clear answer what goes wrong.

Redirect to facebook (response 302):

https://www.facebook.com/dialog/oauth?client_id=166958180001271&redirect_uri=http%3A%2F%2Fdomain.com%2Fscripts%2FGateway.php%3Faction%3DAllowFacebookAccessAction%26app%3D14&state=0dbc178a375595da4751265a7147c01e#_=_

Redirect to mydomain (response 302):

http://domain.com/scripts/Gateway.php?action=AllowFacebookAccessAction&app=14&state=0dbc178a375595da4751265a7147c01e&code=AQD-dTeyns0OWpGb_PzfHxUy2iRmpc1XgP6Q24DDRX8MiRTE10lV-b-aSNIlOLVHk576vRs3H8Pf9n0kGwU827MrkzUCUoQGFGEQBkkOJnCy9zb6hZs7TVBsKL2iSuZIhDjLsCOPeKy3zfb37Q6LGhtMICCdB_IQAvU0uRvAkSAX8tdVJ65PEv8imx-2yvLaMoGJleZwKogh7m03vlhV8hJk#_=_

Part of the code that creates this issue

...            
    $facebook = new FacebookApi(array(
            'appId' => $app->getProperty('apiKey'),
            'secret' => $app->getProperty('secretKey'),
        ));
    $user = $facebook->getUser();
    if (!$user) {    
        header('location: ' . $facebook->getLoginUrl());
        exit;
    }
...

UPDATE:

I ruled out that its a server setting. I was able to run the original example script on that server.

  • 写回答

1条回答 默认 最新

  • douzhunlan5930 2012-11-11 23:21
    关注

    Recheck your app secret in your app settings https://developers.facebook.com/apps otherwise dump the session

    <?php print_r($_SESSION); ?>
    

    And lint the token returned https://developers.facebook.com/tools/debug

    Pretty sure either the token is mangled or the secret.

    If not, it's in code you haven't shown.

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

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序