Below is a list of various Facebook modules that are currently available. Each provide a partial attempt at integrating Drupal with the Facebook API, but none of them address the most critical issue - application integration and user/session management.
My goal is to create a module that allows a single Drupal site to be related to a single Facebook application. This will also relate a Drupal user to their Facebook user ID, as well as their application session key if they have installed the associated Facebook application. (Note, session keys allow you to asynchronously writing to profiles, feed actions and more.)
In addition, it would be nice to have a way to mange profile writing and feeding using themes, roles, actions and other existing modules.
Is anyone else interested in taking these modules to the next level?
Logging in and providing a Facebook API wrapper is nice, but it is only a fraction of the power.
Facebook Module
http://drupal.org/project/facebook
Allows users to authenticate against Facebook and then creates the relevant local Drupal account.
Facebook API
http://drupal.org/project/facebook_auth
One click login using the facebook api.
Facebook API Module(s)
http://docs.projectopus.com/releases/facebook_api
A simple framework for creating FB apps (using Drupal as a back-end for the canvas page).
- dministrative interface for entering API key, shared secret.
- Wrapper functions for loading a Facebook API instance.
- Global access to the currently loaded Facebook API client.
- API client checking to ensure the FB client is accessible, and readable.
- GUI form for creating a new App: specifying canvas callback URL, App title, and canvas URL path.
- Works with facebook_api module to access the facebook client.
- Handles basic FB client errors and misconfiguration problems "sort of gracefully."

Comments
but none of them address the
This is done by the Core-Module. Why should Facebook do this for you?
False
False - Drupal core does not solve this issue.
To clarify, each Facebook user who installs an application has a unique session key which allows the application to asynchronously write to their profile, feed actions and more.
Trust me, this is critical. I've developed many Drupal sites, was a beta partner for the Facebook API launch, and have since launched over 5 FB applications. I'd rather not have to announce my qualifications, but the lack of support has been very frustrating. IMHO, Drupal would see a big boost if users could easily create FB apps.
Sorry
I've got you wrong. :-S
Now I see clearly.
Apologies for disappearing ..
Hello All,
My apologies for falling of the face of the earth. I have been making a lot of progress on most of the issues discussed here but haven't had the time to format my results nicely or distribute the code (hoping to have an SVN repo up soon so you can download my snapshots whenever you like).
Moshe has been encouraging me to get this code into Drupal.org, but I feel it's a bit to shaky to request inclusion in the CVS yet.
I'm building this platform as I build my own Facebook App (which has deadlines and money attached to it, hence the "falling off the face of the earth" stuff).
I've updated the docs.projectopus.com site with the latest and greatest versions of my code. Link: http://docs.projectopus.com/releases/facebook_api
The updates are very large and include: internal versus external user authentication, uses authmap now, session handling, fb session management, proper drupal form/theme integration, css integration, and a whole ton more.
Cheers,
PS: If any of you are in the Vancouver, BC Canada, area and are interested in this stuff. My team and I are presenting this platform, and a bit of our app, to the Drupal user group this coming Thursday.
James.
Qualifications Announced
Heh, good to see more traction here. I'd actually love to announce my qualifications if you don't mind: our 3 FB apps have a total of 2.5 million+ users! (Pats himself on back.) 2 of those are just straight PHP5 OOP but one is Drupal and I'm thinking about starting another Drupal-FB app.
Moshe initially worked with us on our facebook auth module (which is authentication for use within a FB app). We also have some auxiliary modules which store a user's infinite session key (for posting to mini-feed later) and some other stuff. Been so crazy we haven't had time to generify much code.
What I would like to see from collaboration:
I did however send James our Facebook auth code that we have improved and would like to get that out in the open so we can make it way more solid. James, have you done anything with that? If so, send me a patch. Regardless, let's just get that into CVS so we can start getting patches. Should probably be renamed facebook_app_auth or something (we need to put our heads together and plan out all these FB module names and where it makes sense to split up / combine). There are still some quirky 'Session key invalid...' errors we get from time to time and would love to get some help on those issues and some hands to make this code highly reusable and modular.
Its included in facebook_apps.module
Hello Rob,
I've included a lot of your auth code inside my facebook_apps module. I've tweaked a few bit's of it, but it's largely unchanged. I used your singleton pattern in the facebook_api module. I think I've attributed your code everywhere I've used it, but I might not have attributed the singleton code ... lemme check..
Regarding CVS, I've got no problems putting it up if you all think it's the best course of action. I'll apply for a CVS account today.
Lastly, I haven't seen any "Session key .." errors, but I'll keep an eye out. My pattern uses the FB session key to restart the PHP session, thereby giving proper $_SESSION support. I don't use infinite sessions at this time.
Thanks,
James.
how did you guys handle
how did you guys handle username collisions? or do you just use thier userID?
How about the fact that drupal really likes having an email address for everyone but facebook doesn't provide it?
I'm in for helping any way I
I'm in for helping any way I can...probably mostly just testing etc, but I can also donate a bit of money to the project if it's needed.
So far I've come across two issues in the latests facebook_apps release:
In facebook_apps.install at line 8
switch ($db_type) {
case 'mysql':
case 'mysqli':
db_query(
"CREATE TABLE {facebook_user_info} (
uidint(11) NOT NULL DEFAULT '0',session_keyvarchar(255) NOT NULL DEFAULT '',xmltext,PRIMARY KEY (uid)
) /*!40100 DEFAULT CHARACTER SET utf8 */"
);
Is missing a semicolon that prevents the table from being created....it should be:
switch ($db_type) {
case 'mysql':
case 'mysqli':
db_query(
"CREATE TABLE {facebook_user_info} (
uidint(11) NOT NULL DEFAULT '0',session_keyvarchar(255) NOT NULL DEFAULT '',xmltext,PRIMARY KEY (uid)
) /*!40100 DEFAULT CHARACTER SET utf8 */;"
);
and on line 38 in the facebook_apps.module $mid = menu_get_active_item(); seems to be causing access denied errors for non superuser accounts.
Let me know when the CVS is up and I can create actual bug reports for these.
Thanks for the great work.
settings
Thanks, the updates sound very promising.
Please let us know when this gets in CVS.
Here are a few more bugs/requests...
Where should we set this variable? Could this just be an admin setting form at /admin/settings/facebook_app? The only admin page page I can find is /admin/settings/facebook_api.
The directions for using the demo app aren't clear. I got parts of it working, but either something is broken or missing (probably the variable above)
Thanks again!
Fixed, fixed and will be fixed soon..
Hello,
Three developments ..
Cheers,
James.
I'm interested in this too, and have done some work
I believe you should be able to expose on Facebook anything (or just about anything) you can build in Drupal. With the sort of account management you talk about. I've been working on this and thanks to your post I've learned about the effort of the guys working on Project Opus. I had planned to release my code on Drupal.org soon (before Drupalcon). And hopefully we can all join forces to put together some modules that satisfy us all.
Here's a demo of Drupal on Facebook:
http://apps.facebook.com/drupalforfacebook
Nice work
The demo works great! (I did get 1 access denied after the $facebook->require_login() function)
We really need to get these projects in CVS so we can merge all our efforts.
CVS++
If anyone already has an account, please create the project (facebook_api ?) and then help the others get CVS accounts by becoming co-maintainers. If anyone needs help with this, please contact me directly.
I have an account
I do have an account and will post here as soon as I've checked anything in.
I'd like to touch base with James Andres of the Donat Group before I do that.
Co-developers / Co-maintainers?
Hello,
Thanks for the call last week Dave, I'm glad to see there's quite a few developers who are keen to keep this project rolling.
I've got these modules in CVS sandbox now, soon to be moved into the contributions section.
Dave, Boris, etc.. let's talk next week about getting some co-maintainers on this thing. I've got a huge project coming down the pipe at work and I'll likely have to fall off the radar for a bit. I know there are a lot of people interested in hacking this code, so let's get them involved :-).
Cheers,
James.
Any developments?
Has anything happened with this? I'm pretty keen on finding a module that will grab your FB details, prepopulate a couple of registration field and then create the user - and also have the ability to then login to the site after that.
http://drupal.org/project/facebook_auth this sort of does it, but it doesn't prepopulate. Would you then be able to send the field details in the URL?
Maybe a separate Facebook_register module?
Facebook Problem with Drupal 6.X
Hi
I am working on Drupal 6.X and i have the problem with integration with facebook api.
Using Facebook 6.x-1.x-dev api.
Any body help me.
Thanks,
Ahmad
Facebook user import
I am looking for a way to allow drupal to pull in the facebook information from my friends and somehow create a contact database. I know that anything is possible but does anything like this exist? I am not looking to develop a Facebook application... yet... But I am looking for a way to track and sync contacts somehow within Drupal. Maybe even have some sort of LDAP interface that can sync with my iPhone/iTouch.