Note that there are some explanatory texts on larger screens.

plurals
  1. POaccess_token expires? I'm trying to query a public post w/JS. Easier way?
    primarykey
    data
    text
    <p>Beginner here, and I've been getting lost in the Facebook developer docs and Google for hours. I'm sure this is a simple question, but I just need some direction.</p> <p>What I'm trying to do: query latest post of a page owner from a public Facebook page with JavaScript and parse it to display within my own HTML (can't use a <a href="https://developers.facebook.com/docs/plugins/" rel="nofollow">Social Plugin</a> - I need custom control over HTML/CSS).</p> <p>What I've got working so far:</p> <pre><code>var token = '&lt;my_token&gt;'; var query = 'fields=posts.limit(1)'; var request = 'https://graph.facebook.com/[mypage]?' + query + '&amp;access_token=' + token; $.getJSON(request, function(response) { alert(response.posts.data[0].message); }); </code></pre> <p>This does work, however, the <a href="https://developers.facebook.com/tools/debug/access_token?q=" rel="nofollow">Access Token debugger</a> says my access_token is going to expire in 2 months. Why? It's a public Facebook page, and I only want to query the page owner's latest comment. Do I really need to create a Facebook App and login via PHP to just to access this public information?</p> <p>I'm doing the exact same thing with a Twitter feed and all I had to do was $.getJSON <a href="http://api.twitter.com/1/statuses/user_timeline/" rel="nofollow">http://api.twitter.com/1/statuses/user_timeline/</a>.json, completely in JavaScript.</p> <p>It seems getting similar information from Facebook is much more difficult, but perhaps I'm going about it the wrong way?</p>
    singulars
    1. This table or related slice is empty.
    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.
    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