Note that there are some explanatory texts on larger screens.

plurals
  1. PONot receiving signed_request in Facebook iframe-app
    primarykey
    data
    text
    <p>I have created a Page Tab Facebook App where I want to display different content depending on the user being a fan or not. (Also called fan gate, landing page or reveal page)</p> <p>For this I'm using the PHP SDK, in specific the following code:</p> <pre><code>&lt;?php require 'src/facebook.php'; $facebook = new Facebook(array( 'appId' =&gt; 'APP_ID', 'secret' =&gt; 'APP_SECRET', 'cookie' =&gt; true, )); ?&gt; </code></pre> <p>And in the content:</p> <pre><code>&lt;?php $signed_request = $_REQUEST["signed_request"]; list($encoded_sig, $payload) = explode('.', $signed_request, 2); $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true); if (empty($data["page"]["liked"])) {?&gt; Thank you for liking our Page! &lt;?php } else { ?&gt; You haven't liked our page yet.. &lt;?php }; // Debugging Code echo "REQUEST:&lt;br&gt;"; print_r($_REQUEST); echo "&lt;br&gt;GET:&lt;br&gt;"; print_r($_GET); echo "&lt;br&gt;POST:&lt;br&gt;"; print_r($_POST); ?&gt; </code></pre> <p>This works when I'm logged in with my Facebook User and when I use it on my own Page. Meaning the signed_request is present in both $_POST and $_REQUEST.</p> <p>However, when I test it with another user, there is no signed_request value in those variables..</p> <p>Notes: - I already took a look at my URL Settings in the App Configuration (300 Redirect and stuff) but this looks fine, and like I said with my User it's working.. - the signed_request is not just empty, it doesn't even exist.</p> <p>Does anybody have similar issues?</p> <p>I would not mind using the Javascript SDK instead of PHP if it works then, but I'm not very experienced in Javascript.</p> <p>EDIT:</p> <p>As i found out you always have to have a non-secure (http) and a secure (https) URL. Even if you enter a secure URL as the standard URL, facebook will contact it using http and will then get redirected (depends on server configuration) to the https, which makes you lose your signed_request.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload