medo ampir
medo ampir

Reputation: 1910

why can't i see the signed_request in all my facebook application pages?

my facebook app consists of some php pages it the first page appears in the canvas url i can get the user data from the signed_request parameter like this:

 $app_id = "1111111111111111";

 $canvas_page = "http://www.mydomain.com/fb/app/";

 $auth_url = "https://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($canvas_page) . "&scope=email,read_stream";


 $signed_request = $_REQUEST["signed_request"];


 list($encoded_sig, $payload) = explode('.', $signed_request, 2); 

 $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);

 if (empty($data["user_id"])) {
        echo("<script> top.location.href='" . $auth_url . "'</script>");
 } else {
        echo 'welcome user';
      } 

but when i navigate to other pages or a page in an iframe within my app i can't see this parameter. so is it only the first page loaded in the canvas that the facebook sends this parame

Upvotes: 1

Views: 478

Answers (1)

Floyd Wilburn
Floyd Wilburn

Reputation: 1842

Correct. Only the first page loaded into the iframe will receive the signed_request parameter. It is up to you to parse it there and then carry whatever data you need to subsequent pages.

Upvotes: 1

Related Questions