Reputation: 25
I am making an application and on the "front" page of the Tab I get the signed_request. But when I navigate to different pages on the app it stops providing the data.
So far this work:
$signed_request = $facebook->getSignedRequest();<br />
$user_profile = $facebook->api('/me');<br />
echo $user_profile['id'];<br />
echo $user_profile['name'];
echo $_SESSION['signed_request']; // Returns the data
But when I navigate to other pages, it doesn't give anything. It looses everything. How can I keep the data from the signed_request? Do I need to use sessions in some way?
Upvotes: 1
Views: 1181
Reputation: 129
I've found that the signed request isn't always passed to each page, so I used the following to hold that myself in the session object. I set this on the login page before I redirect to other pages in my app:
if (!isset($_SESSION["SR"]))
$_SESSION["SR"] = $_REQUEST["signed_request"];
$signed_request = $_SESSION["SR"];
Hope that helps.
Upvotes: 2