Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (22 sloc) 1.88 KB
Read the full article "Omniauth pure: Authentication with Facebook, Google, Google Apps, Twitter, Github, AOL, MyOpenID and many other OpenID providers" on CommunityGuides:
This article will demonstrate how to set up a multi-provider authentication using the fabulous Omniauth gem. Users will be able to add multiple providers to their account and views for sign-in, sign-up and management of linked accounts are provided. The full source code is available on Github as a basis for your own projects.
Ruby on Rails CommunityGuides follows the purpose of giving back to open source - more specific, to the Rails community. It has been built to provide a basis to share knowledge on Ruby on Rails development. Developers from all over the world can share their knowledge easily and gain profit from the knowledge of other developers. All content is free and published under a Creative Commons license.
Omniauth Buttons:
If you want to use Omniauth pure as a starting point in one of your applications, you just need to:
* add Omniauth to your gems
* generate a user model with whatever fields you like: rails generate model user name:string ...
* generate the service model: rails generate model service user_id:integer provider:string uid:string uname:string uemail:string
* generate the service controller: rails generate controller services
* set the secret for the cookie store in config/initializers/session_store!
* copy part of routes.rb
* copy the models service.rb and user.rb (or edit, if you already have a user model!)
* copy the code of the services_controller
* copy all views from services
* copy (parts of) the stylesheet
* and refer to the article for details...
June 2012 - Jorge Barnaby
Updated for Rails 3.2.6 and Omniauth 1.1.0