Facebook Connect: Login to a website without registration

21 May 2009 Published in Blog

What is Facebook Connect?

Facebook’s new product called Facebook Connect allows us to use the same login on multiple sites without the need to record us as a new user.

With this new service, we may also import all our contacts and our social network, with full profile, to the other sites included in the agreement.

The rough idea is to share the record of Facebook on other sites to avoid having to register each time.

How to Link to Facebook?

1. Create a Facebook application development: we must start by having a user, then enter the  developers area https://www.facebook.com/developers/editapp.php to register a new application. We have to fill optional fields and CallBack URL with the URL of the site to which we link Facebook. Leave the other in default would be the right thing, then accept.

I recommend saving the API Key, because we use it in a moment.

2. File Connection: Now we return to our project. We can create a folder to save files in Facebook, or place them in the same root.

The first file you need to create is one that creates the connection to Facebook:

xd_receiver.htm

1
2
3
4
5
6
7
 






3. Login Form: only need to include some scripts that allow us to register for access to personal data, which are on Facebook, users of our site.

The following is a sample file called

test.html

1
2
3
4
5
6
7
8
9



 
 





It is important to respect the xmlns attribute of the html tag also you must replace YOUR_API_KEY_HERE with the number of API key that you saved in the previous step.

After doing this we can access oursite/test.html and verify that the connection works.

Needless to say it is a basic connection, since it does not interact with our system of logging, but serves as a basis for explaining how the systems logging more complex, as we shall see below.

For more information, see: https://wiki.developers.facebook.com/index.php/Trying_Out_Facebook_Connect

What to do with Facebook in our site?

The big advantage is that allows logging into the site without registering, we may automatically be currently logged into our site. To facilitate this functionality, Facebook has an Open Source app containing all the necessary libraries to include in the website. You can download it here: https://svn.facebook.com/svnroot/platform/samples/packages/therunaround.tar.gz

An important modification to be able to use the code is as follows: in the file lib/fbconnect.php within render_fbconnect_init_js function (), replace %s by the number of API KEY generated when creating the Facebook Application that we are developing.

In addition to the logging system, the example shows that we can use other tools, such as posting on our Facebook profile or to import into our website from Facebook user data such as personal profile, list of contacts and friends. To do so, Facebook provides us with a tool: XFBML a language that is compatible with HTML tags, which can bring data from the user logged in a simple way:

1
 

Where only giving parameters uid and user id, (data that we know through the User class, downloaded a few steps back), we can bring this data in particular.

For more information, visit this link: https://wiki.developers.facebook.com/index.php/XFBML.

Serfe info(at)serfe.com https://www.serfe.com/images/serfe_logo_text.png https://www.serfe.com/images/serfe_logo_text.png FALUCHO 2032, S3016LDB, SANTO TOME, SANTA FE, ARGENTINA 1-305-5375397
Cookies & Privacy: 
This website uses cookies to ensure you get the best experience on our website.


Privacy Policy