Note that there are some explanatory texts on larger screens.

plurals
  1. POFacebook API offline newsfeed access
    text
    copied!<p>I have offline access granted by the user, and expires=0 for the session, so it never expires. I have stored all the session values like access_code etc in a database. Immediately after storing the values, I can read the newsfeed. After 2 secs, when I try to use these stored session values to read newsfeed of the user, it is not working. <strong>OAuthException: An active access token must be used to query information about the current user</strong> </p> <p>In Php, I am using this line to read newsfeed:<code>$result=$facebook-&gt;api("/me/home?access_token=".$access_token); </code></p> <p>Strangely, when I enter the access code to the url of the browser, it is working:</p> <blockquote> <p><a href="https://graph.facebook.com/me/home?access_token=" rel="nofollow">https://graph.facebook.com/me/home?access_token=</a>$access_token. </p> </blockquote> <p>Remember, when the user gives you the permission, you get this in url: <code>http://example.it/home/newsfeed.php?perms=&lt;permissionlist&gt;&amp;selected_profiles=&lt;uid&gt;&amp;installed=1&amp;session={session_key:&lt;session_key&gt;,uid:&lt;uid&gt;,expires:0,secret:&lt;secret&gt;,access_token:&lt;firstpart&gt;|&lt;secondpart&gt;|&lt;third part&gt;,sig:&lt;sig&gt;}</code></p> <p>my permission list is this:</p> <blockquote> <p>"friends_about_me,friends_education_history,friends_likes,friends_interests,friends_location,friends_religion_politics, friends_work_history,publish_stream,friends_activities,friends_events, friends_hometown,friends_location,user_interests,user_likes,user_events, user_about_me,user_status,user_work_history,read_requests,read_stream,offline_access,user_religion_politics,email,user_groups";</p> </blockquote> <p><strong>when I enter the url above to any browser, it gives me the news feed of uid, as the newsfeed.php has the php code that outputs newsfeed. It does not matter if the user is logged in, or not. IE even downloads the json result as a file</strong></p> <p>So the session information is not really expired, it is working. But somehow, I cannot get Facebook to believe that I have the right credentials to read the newsfeed.</p> <p>Any help is much appreciated. Please write how I can reconstruct the session values and have Facebook believe in me. </p> <p><strong>My final solution can be found on my updated blog: <a href="http://akcora.wordpress.com/" rel="nofollow">http://akcora.wordpress.com/</a></strong></p> <hr> <p>I also forgot to mention that, even if the feed does not work, i can still post status messages to the user's profile. This does not make any sense. I am almost sure that I am making a mistake at coding. For example this is the status posting code that works: </p> <pre><code>$attachment = array( 'access_token' =&gt; $access_token, 'message' =&gt; 'Did a Test Post :', 'name' =&gt; "Offline posting using stored tokens", 'link' =&gt; "http:somelink.com", 'description' =&gt; "This post was made using a stored access token", 'picture'=&gt;"some.jpg", ); $ret_code=$facebook-&gt;api('/'.$target.'/feed', 'POST', $attachment); </code></pre> <p>but getting the feed does not work. The security should be tighter for posting than getting the newsfeed, right?</p>
 

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