views:

1439

answers:

2

I want to allow users to sign in using facebook as well to my website, since the recent release of new Facebook stuff, I am unsure which one to use. Previously, Facebook Connect was used. Now we have Facebook authorization feature, using the OAuth 2.0.

Please tell me which one to use? and Is Facebook Connect going to be obsolete?

I am new to Facebook Development.

A: 

You can use these facebook connect tutorial as per the new API:

PHP SDK & Graph API Base Facebook Connect Tutorial
Graph Api & Javascript Base Facebook Connect Tutorial

Sarfraz
I am still not sure, should I ignore Facebook Connect?
AJS
@AJS: No you should not, it is still there in a bit different way now with new API.
Sarfraz
Thanks for the help man, but I need to pick one. :) Which one?
AJS
@AJS: If you are going to use php, go for first one and if javasript, go for the second one.
Sarfraz
+8  A: 

I would pick the Graph API and authorization using OAuth. The Facebook Javascript SDK is really nice and has come a long way. The SDK, coupled with the Graph API makes it very easy to do Facebook integration. Whenever you need data from Facebook, create an http request on your server side and deserialize the JSON that gets returned by the Graph API. Any client side interaction can be done through the Javascript SDK (or use your server as a facade to the Graph API and return the JSON directly to the client for processing). oAuth is an opens standard also (as opposed to Facebook Connect).

After you have an access token, you can query the graph API restfully to retrieve data.

For example:

https://graph.facebook.com/me?access_token={0}

Would return information such as the Id, FirstName and LastName. All in JSON format.

The Facebooks Graph API documentation is pretty good.

Here is a walkthough on how to perform oAuth authentication (both logging in and logging out).

and Is Facebook Connect going to be obsolete

The only thing I can see becoming obsolete would be FBML Facebook applications (versus using an iFrame). This again is because of Facebook's Javascript SDK. As from a strict "gut" feeling, the Graph API just feels right. It's restful in nature and highly interoperable with anything that can parse JSON.

I am new to Facebook Development.

Some words of wisdom:

  • Choose IFrame over FBML
  • The Facebook Javascript SDK is a wonderful asset
  • jQuery will prove to be invaluable for working with client side Facebook stuff
  • Use the oAuth protocol for authentication (again, this and the Graph api are nice and "Restful")
  • Get familiar with FBML. The Comment FBML tag is probably the easiest to integrate into your website. So start with that and build from there.
  • IE will not be able to run your iFrame app unless you include a P3P header in your HTTP response. This blog post will give you some tips on how to use oAuth in your iFrame apps and how to deal with IE's iFrame problems.
Amir
Thanks for the great writeup on the situation. I'm diving into facebook integration, will be porting old fb connect login to new auth, and adding features using graph api. This is a huge help gettings started!
Jason
+1 to Amir. I work on the [JavaScript SDK](http://github.com/facebook/connect-js) and I can tell you it won't be going away anytime soon :) While we are moving away from the "Facebook Connect" brand, the technologies used there were and are part of the core Facebook Platform which is still very much supported. And while the Auth flow in the JS SDK is not built on top of OAuth2 yet, it will be as soon as we get to it (but it already provides the `access_token`, so you can use it with OAuth2 and Graph today!). The JS SDK also makes it much simpler imho: http://fbrell.com/auth/all-in-one
daaku
Can I use OAuth2 to register/login a user and then be able to display a publisher?
PanosJee

related questions