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.