Twitter and Facebook based login for Plone

Jul 13, 2012
We have been working on a Twitter and Facebook based login in Plone for a project that will be published in the coming weeks. Today we have released the first beta version of both products.

We needed to log into a Plone site using Facebook and Twitter and I found some code about in in Martin Aspeli's Professional Plone 4 Development. Although perfectly usable, that code didn't fill all of our needs, and basing on that, I created a product to implement Facebook based login and uploaded to GitHub.

We fastly realized that we need to make some changes to the code because it was tied just to the logged in user, for instance, it wasn't posible to show other users' data. While I was working on the product and lurking on #plone, David Jonas asked about a Facebook authentication plugin for Plone. I pointed him to my code and we started testing and discussing the scope of the project. We wanted a simple PAS plugin to be able to login in Plone using external authentication, provide user properties coming from Facebook and allowing to get data of other users already logged in at least once in Plone.

After some testing and changes, I got a pretty stable code and will be put in production in the coming weeks. The idea with Twitter authentication is the same, the code is pretty much the same, except the authentication process.

The only strange thing here is the use of collective.beaker. Martin was using Beaker in his code to provide persistence to the session coming from Facebook and I reused that code. Now, I think that I could remove that requirement quite easily, and thus, create a simpler product.

But that's one of the points I want to do after this publication: to have feedback about the product. I know, that testing is important and that untested code is broken code, and that's why I am shamed because of the lack of tests in this product... Well :)

Thanks David Jonas for his testing and valuable feedback, and also RedTurtle for copying and reusing this Facebook login process in their Earthquake recovery project.

So, you can add this products in your buildouts and test them, the beta versions are already on PyPI and the code in GitHub. Enjoy!


To comment this article you have to log in using your Facebook, Twitter or Google account.

Mikel Larreategi

Plone developer. Chess International Arbiter #truestory