开发者

Facebook API Authentication in Coldfusion without login box

I have been looking for information on how to authenticate to the facebook api without a login button and haven't been able to find anything. Essentially I want t开发者_JS百科o pull data from a static user (I don't want to pull information about every person that visits the page specifically, I want to pull information from a specific user account).

I want to convert the feed I retrieve into an rss feed, or an ATOM feed for my client to display in their website.

Is there any information about how to authenticate in this way?

An example of info I would want to pull would be to pull the wall posts from their facebook account and display them as a feed.


No matter what you do, login button or not, you will have to have your user Authenticate with your application in order to retrieve any sort of data.

The easiest way to do it is to use either the facebook login button or use the Javascript SDK and do something like this...

    FB.login(function(response) {
  if (response.session) {
    if (response.perms) {
      // user is logged in and granted some permissions.
      // perms is a comma separated list of granted permissions
    } else {
      // user is logged in, but did not grant any permissions
    }
  } else {
    // user is not logged in
  }
}, {perms:'read_stream,publish_stream,offline_access'});

http://developers.facebook.com/docs/reference/javascript/FB.login/ Then once you get the user authenticated you can grab the cookie that is created by doing

<cfscript>
var fbcookie = cookie.fbs_YOURAPIKEYGOESHERE;
</cfscript>

There is more info on the cookie here... http://jcreamerlive.com/2011/01/12/facebook-and-coldfusion/

From there you can use the javascript FB.api and do FQL queries http://developers.facebook.com/docs/reference/javascript/

Or you can use cfhttp posts to the Graph API http://developers.facebook.com/docs/reference/api/

Have fun!


You need to authenticate the app using oauth2 method with a offline_access permission. You will get an access token that does not require user login to access to the account. I give a more detail and links to the relevant fb documentation pages in this answer:

Is it possible to do Server -> Facebook authentication?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜