Integrating with Friends & Web Sites / Implementing Facebook Connect
Subtitles of the Movie
Now, here is the Facebook example code for implementing Facebook Connect on your site. This is the basic login that you do and beyond this, whether you want to access the friends list or access your own data, move things up or not, all of those are other calls that you will be able to make and they are basically the same as the calls that you make from within Facebook when you're writing your own app, but this is the key part; this is the login. This is your web page and what this web page has to have is the application secret code that you register for. You register just as you would for any application and one of the things that you'll do is to provide the URL for the application, just as you do with your own applications for Facebook. So the web URL is provided and there's going to be a little bit of monkey business here that I'll show you because you'll be able to use a sub-domain. But basically what you want is you'll use this code exactly as it is shown here. This is the FBML code for the login page, for that button. And this will let you connect, this will render the button and then you need to call FB init with your secret key and the name of a special file and this file is to be installed in, without any changes, in the sub-domain where you want all of your Facebook Connect files to reside. So the domain will be registered with Facebook for your Facebook Connect domain and this file will be in the sub-domain and it will let you communicate back and forth. This is all documented if you go to the Developer's Page, click on Facebook Connect on Facebook. Then you'll find the Getting Started Page for Facebook Connect and it walks you through this entire process. This is all you basically need to do to implement the beginnings of Facebook Connect from one of your web pages. Now, this code is the code that you download from Facebook to implement the logging. With the, all you have to do is modify your secret key. But let me point out something else to you in case you are tempted to just look at this and think oh, it's standard, standard code. Up here notice that we have the, in the HTML element, we are going to the FBML syntax so this is what is going to enable you to type in code such as this FBML code here. That's the key line for the translation. Don't change anything in this file except your secret code and possibly the name of this cross-domain file. Now that you've been able to connect your users to Facebook Connect, it's time to think about what you're actually going to do in that connection and the key to this is XFBML, which is a flavor of FBML that can be used on a Facebook Connect page. And what you see here, this is the URL with the most complete information about using XFBML and this is, this, remember, this is going to be code that you're going to place on your HTML page and in looking at all of these extensions, the XFBML elements that you can place on an HTML page, as long as you've got that link at the top in the first HTML tag. Notice in the descriptions this constant phrase which is just like the FBML tag of the same name. This is an XFBML tag that goes on a website page written mostly in HTML but these are all the elements that you can use that behave just as the elements you're used to in Facebook, that you put on your own canvas pages. In addition, you can use the Facebook API methods because part of the procedure for connecting to Facebook Connect is your application secret key and that means that you now have access to the API calls. So you can write code just as you do in Facebook itself.
Tutorial Information
| Course: | Facebook Application Development |
| Author: | Jesse Feiler |
| SKU: | 34058 |
| ISBN: | 1-935320-81-5 |
| Release Date: | 2009-11-23 |
| Duration: | 7.5 hrs / 92 lessons |
| Work Files: |
Yes |
| Captions: | Available on CD and Online University |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 