Rails, Authentications, Social Networks and Me

In the first application I developed in Ruby on Rails, I was asked to give user the option of logging in the site without registration using his/her social network account. Being new to the RoR, it was a bit difficult to play with bit complex plugins. But somehow I created two sample applications, one for twitter and other for facebook. The gems/plugins I used at that time were twitter-auth and facebooker respectively.

It was all coming good until I had to incorporate them in one application. It was pretty painful process and required quite a bit of customization. Afterward, the next requirement was to allow user to merge accounts. Believe me, it was something that took some effort of even the experienced resources I was working with. It needed overriding of few methods and we even made some changes in the plugins’ sources especially the facebooker.

Last week, I had to develop a quite similar website in Rails 3. I seems to be a horror when I received the requirement document as I’d never worked in Rails 3 before. But when I actually started development, it worked like a charm. I’m duly impressed by the power of Rails 3 and it’s ease of use. In a far lesser time, my application is all ready with basic and social authentications.

As I write, most website owners will want to allow access to their sites using facebook, twitter and other social networking sites to save user from giving all the personal data again and remembering another username/password combination. So, I thought to publish what I’ve done so far to help other newcomers in Rails working out a solution.

This time, I used following gems to build solution:

  • Authlogic
  • OmniAuth
  • fbgraph
  • twitter

Though, OmniAuth is recommended with device, I used it with authlogic and it worked fine. OmniAuth is very powerful gem which not only allows you to authenticate but you can do everything related to social networks, like post a link on facebook, with it.

I’ll soon be releasing a complete tutorial for beginners on authlogic and omniauth. Till then, you can build an application with Rails 3 using authlogic.

Authlogic railcasts: http://railscasts.com/episodes/160-authlogic
Authlogic with Rails 3 tutorial: http://www.dixis.com/?p=352

Or you can google a bit and find a tutorial on authlogic+rails 3 of your liking.

Advertisements

2 thoughts on “Rails, Authentications, Social Networks and Me

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s