Note that there are some explanatory texts on larger screens.

plurals
  1. POServer Side OAuth Facebook Token Refresh
    primarykey
    data
    text
    <p>I have a ColdFusion web page that gets refreshed by my server every x minutes. That script checks various feeds (Facebook, YouTube, and internal news items) and builds a merged feed in chronological order. The Facebook part just pulls post data from our Facebook Fan Page. I can do this with the OAuth token provided when I authorize my app from our account.</p> <p>The token expires every couple of months or something I think. It lasts a pretty long while, and I have read there is no way to auto Authorize an app. I however keep reading about these refresh tokens or something but can't get a clear grasp on how they work.</p> <p>I would like my script to attempt to get the JSON data from Facebook, and if the token expires every so often, re-request it, but it appears that just hitting the graphs.facebook.com/oauth/authorize link again doesn't work because obviously you need to be logged in for it to authorize something.</p> <p>Is there anyway I can internally reauthorize or refresh my token server side. This Facebook app, site, and Facebook users are all completely internal. There used to be an RSS feed of facebook pages, but Facebook changes stuff all of the time and I don't see it anymore.</p> <p>All I really need is the data from the timeline/feed for my Facebook Company Page.</p> <p>Any solutions or suggestions would be helpful.</p> <p><strong>ANSWER:</strong> This is what I ended up using to get the data based on the content. Below grabs the token, then uses the token to grab the feed data and puts it into a struct. It may not be the most concise way, but it works.</p> <pre><code>&lt;cfhttp url="https://graph.facebook.com/oauth/access_token?client_id=[CLIENTID]&amp;client_secret=[CLIENTSECRET]&amp;grant_type=client_credentials&amp;redirect_uri=[URL] " result="AccessHTTP" /&gt; &lt;cfset token = replace(AccessHTTP.Filecontent,"access_token=", "", "ALL")&gt; &lt;cfhttp result="result" url="https://graph.facebook.com/[USERNAME]/posts?access_token=#token#" &gt;&lt;/cfhttp&gt; &lt;cfset Facebook = deserializeJSON(result.filecontent).data /&gt; </code></pre>
    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.
    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