开发者

Application facebook - Passing a parameter into the url delet the facebook $session?

开发者 https://www.devze.com 2023-03-03 18:40 出处:网络
heres my problem. the index.php file Code: <?php require_once (\'../src/facebook.php\'); $facebook = new Facebook(array(

heres my problem.

the index.php file Code:

    <?php

    require_once ('../src/facebook.php');
    $facebook = new Facebook(array(
    'appId' => 'xxxxxxxx',
    'secret' => 'xxxxxxxxxxxxxxxxxxx',开发者_如何学JAVA
    'cookie' => true,
      ));
      $session = $facebook->getSession();
      print_r($session);
       ?>

It works fine, i do have all the $session information.

But as soon as i call index.php?param=x, i dont have anymore my session information.

How come?


I looked inside facebook.php, when you're using OAuth 2.0 that uses signed_request, it is the first source where it gets the session.

signed_request is passed to you using POST for canvas if it is enabled in advanced settings.

When you navigate to other pages using GET method like index.php?param=x, you lose the signed_request.

We had this problem before and opted to use AJAX inside our iframe to retain the signed_request in index.php and the ajax-loaded pages will generate cookie-based session because they don't have signed_request.

If you want, you can also disable OAuth 2.0 in advanced settings.

0

精彩评论

暂无评论...
验证码 换一张
取 消