Once again over at railscasts.com Ryan Bates has done an excellent job of showing off how to use the OmniAuth gem to provide a oauth authentication model via twitter. From the omniauth github page you can clearly see there are many authentication providers in which this small gem can integrate with. It provides a clear and simple way of doing user authentication in about 5 minutes securely.
As a reference I’ve packaged up this small micro blog with a omniauth to twitter. Rememeber to head over to dev.twitter.com and get yourself a oauth key which should be entered into config/initializers/ominauth.rb.
Rails.application.config.middleware.use OmniAuth::Builder do provider :twitter, 'CONSUMER_KEY', 'CONSUMER_SECRET' end
You can get the sourcecode from here: tryout_omniauth
Also if you fancy some more information about omniauth head over to the github wiki for OmniAuth