Clement
Clement

Reputation: 3

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

heres my problem.

the index.php file Code:

    <?php

    require_once ('../src/facebook.php');
    $facebook = new Facebook(array(
    'appId' => 'xxxxxxxx',
    'secret' => 'xxxxxxxxxxxxxxxxxxx',
    '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?

Upvotes: 0

Views: 1097

Answers (1)

dragonjet
dragonjet

Reputation: 1006

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.

Upvotes: 1

Related Questions