Note that there are some explanatory texts on larger screens.

plurals
  1. POAuthorize and PHP-Session
    primarykey
    data
    text
    <p>I'm trying to find a solution for hours - without success. So I hope that maybe one of you can help me with this: It seems like this script allways starts a new session - and I don't know why.</p> <pre><code>&lt;?php $code = $_REQUEST["code"]; if(empty($code)) { $_SESSION['state'] = md5(uniqid(rand(), TRUE)); $dialog_url = "https://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&amp;redirect_uri=" . urlencode($my_url) . "&amp;state=" . $_SESSION['state']. "&amp;scope=publish_actions,publish_stream"; echo("&lt;script&gt; top.location.href='" . $dialog_url . "'&lt;/script&gt;"); } if($_SESSION['state'] &amp;&amp; ($_SESSION['state'] === $_REQUEST['state'])) { $token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . $app_id . "&amp;redirect_uri=" . urlencode($my_url) . "&amp;client_secret=" . $app_secret . "&amp;code=" . $code; $response = file_get_contents($token_url); $params = null; parse_str($response, $params); $_SESSION['access_token'] = $params['access_token']; } else { echo("Sessionstate: ".$_SESSION['state']."&lt;br&gt;"); echo("REQUEST_state: ".$_REQUEST['state']."&lt;br&gt;"); echo("Sessionstatus stimmt nicht mit dem REQUEST_State &amp;uuml;berein."); var_dump ($_REQUEST); exit; } ?&gt; </code></pre> <p>The session starts in an included file before this script is included with a regular: </p> <pre><code> session_start(); </code></pre> <p>I tried to pass the "state" with </p> <pre><code> &lt;form action="&lt;?=$_SERVER['PHP_SELF'];?&gt;?what=save&amp;state=&lt;?=$_SESSION['state'];?&gt;" method="post" enctype="multipart/form-data"&gt; </code></pre> <p>from my index.php file.</p> <p>Thanks for reading and for helping me.</p> <p>Regards Christian.</p> <p>Edit: Here's the link to the developer-blog: <a href="https://developers.facebook.com/blog/post/2011/05/13/how-to--handle-expired-access-tokens/" rel="nofollow">https://developers.facebook.com/blog/post/2011/05/13/how-to--handle-expired-access-tokens/</a></p>
    singulars
    1. This table or related slice is empty.
    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.
 

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