Drupal authentication with Facebook credentials
Submitted by dave on Thu, 2008-12-11 18:42.
Just a few days ago, Facebook unveiled Facebook Connect. If you're not sure what that is, here's how they describe it: "Facebook Connect lets users log in to a site using their Facebook account, bring their profile with them, easily find friends also using the website, and share information and experiences using the same features as they would on a Facebook application."
That first feature, log in to a site using a Facebook account, means users can access a Drupal-powered website using their Facebook username and password. Similar to OpenId, this can save a user the extra effort of registering with a Drupal site. It goes even further, in fact. If a user is logged into Facebook (or any Facebook Connect enabled site), that user can automatically be logged into any other Facebook Connect enabled site, without even providing a username and password. It's like a single sign on across the internet. To see what I mean, visit www.drupalforfacebook.org. If your browser is logged into Facebook, you should be logged in automatically; and if not you can click the "Connect" button on the right then provide your Facebook credentials.
Unfortunately Drupal and Facebook Connect to not integrate perfectly at the moment. One issue involves logging out. When logging out of Drupal, the user visits the logout URL causing Drupal to do some server-side stuff then the user is redirected to the site homepage. Whereas Facebook Connect requires a javascript function to be called to complete the logout. Because Drupal redirects instead of showing a page on logout, this complicates matters. My current implementation works around this by adding some extra pages and redirects to the logout procedure. This should be more graceful. If you agree, please add your support to this issue in Facebook's bug tracker: http://bugs.developers.facebook.com/show_bug.cgi?id=3672
On the Drupal-side there are also issues. One is that when a user account is created via Facebook Connect, the user's email address is never known. Drupal does not strictly require an email address for every account, but some parts of Drupal and third-party modules erroneously assume there will always be an email address. Please lend support to issues like this one: http://drupal.org/node/61738.
Another problem is that Drupal requires usernames to be unique, while Facebook allows everyone to use their real name (not unique). This creates problems when generating a username for the users who log in via Facebook Connect. There are a number of other great reasons to remove this silly requirement from Drupal. Again, please back suggestions here and also here.
In short, Facebook Connect offers a great alternative for logging into a Drupal site, much like OpenId does. It can be made to work reasonably well today, using Drupal for Facebook. However with a couple fixes to both Drupal and the Facebook APIs it will be even better.
It seems like some accounts
Submitted by dave on Fri, 2008-12-12 16:51.
It seems like some accounts are logged in automatically, while other have to click the connect button for it to work. I'm not sure what makes the difference, or whether this is a bug.
But you should be able to log into www.drupalforfacebook.org using the Connect button whether or not you have the Developer App installed on your Facebook account.
Thanks for the kind words.
Facebook Connect setup
Submitted by cpelham on Fri, 2008-12-12 19:13.
Hi Dave.
I am really excited about the work you have done on this. I have watched your two videos and have installed and run Facebook's three little demo scripts for Facebook Connect, but I am still unsure how I would set up Facebook Connect as an alternative login option rather than setting up an app on my Facebook page. I will go ahead and install Drupal for Facebook and see if I can figure it out on my own, but if you can provide any additional pointers, I would greatly appreciate it!
_________________
Christopher Pelham
Director
CRS (Center for Remembering & Sharing)
www.crsny.org
Facebook Connect setup
Submitted by cpelham on Tue, 2008-12-16 05:03.
Ah, I see that you do not plan to have a Drupal 6 branch before January, and I am looking for a Drupal 6 solution, so there's no need to respond to my request for further setup instruction until then. Thanks again, and good luck!
_________________
Christopher Pelham
Director
CRS (Center for Remembering & Sharing)
www.crsny.org
Drupal 6 patch in progress
Submitted by dave on Tue, 2008-12-16 11:00.
Christopher,
You can work with this patch in the meantime, http://drupal.org/node/235457.
I didn't reply right away because the instructions are not trivial. I'll include a link here once I've posted something readable.
Facebook connect setup
Submitted by yossilac on Thu, 2008-12-25 12:49.
Hi Dave,
I've installed your module and started playing around with it, but as Christopher mentioned, there are no clues regarding the FB Connect feature.
Are there any instructions anywhere?
Regards,
Yossi Lacoua.
HOWTO
Submitted by dave on Sun, 2009-01-04 01:00.
Ok I had trouble finding time to document this, but I finally got around to it (now that I am supposedly on vacation). Here's how I made the Facebook Connect login block work. But bear in mind I plan to improve the code and build it into the modules. So in the near future this will become much easier. Until then, read http://www.drupalforfacebook.org/node/1134 to enable the same block on your site.


network
Submitted by coltrane on Thu, 2008-12-11 22:20.
I'm logged into Facebook but visiting http://www.drupalforfacebook.org/ doesn't have me authenticated. That's okay, I'm more commenting on what Facebook Connect offers, or hopes to offer, beyond carrying your credentials with you is carrying your social network with you. That's exciting! Thanks for all your work on Drupal for Facebook, Dave.
login or register to post comments