Skip to content
Devise & Omniauth Multiple Providers
Branch: master
Clone or download
AlexanderZaytsev Merge pull request #12 from nikhgupta/fix/update_devise_config
Fixed: Omniauth configuration not being added inside config/initializers/devise.yml
Latest commit 3cafb36 Nov 3, 2014
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib fixed update_devise_config method since devise shifted to new hash sy… Jun 7, 2014
Gemfile Initial Jan 18, 2013
LICENSE.txt Initial Jan 18, 2013
Rakefile Initial Jan 18, 2013
domp.gemspec underscore provider name Oct 24, 2013

DOMP: Devise & Omniauth Multiple Providers

Generator for using Devise & Omniauth with Multiple Providers. I wrote this because I got tired of repeating the same code in every app that required multiple providers.

Basically, to have multiple providers working in a brand new application, all you need to do is run the following:

gem "devise"
rails generate devise:install
rails generate devise User
rails generate domp User facebook twitter

You can list as many providers as you want, check out a full list of them.

Note: this is not an engine but rather a generator which will generate models, controllers and setup configs for you. You are free to change everything. You are the king.


$ gem install domp


First, you need to have devise already installed and your model generated:

rails generate devise:install
rails generate devise User

Run the domp generator:

rails generate domp User facebook twitter

During the generation you will be promted for the provider's application id and secret key.

What is generated for you:


Model & migration. Will be populated with the providers you specify.


Model & migration.

User model additions

Here's what the User model will look like:

class User < ActiveRecord::Base
  has_many :authentications, class_name: 'UserAuthentication', dependent: :destroy

  devise :omniauthable, :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable

  def self.create_from_omniauth(params)
    attributes = {
      email: params['info']['email'],
      password: Devise.friendly_token

    create attributes


Here goes all the logic of creating multiple authentications. You are free to change everything, it's just a boilerplate that will make sense in most of the apps.

Route additions

devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }

Devise config additions

The following will be added to config/initializers/devise.rb:

config.omniauth :facebook, 'x', 'x'
config.omniauth :twitter, 'x', 'x'

Gemfile additions

gem "omniauth"
gem "omniauth-facebook"
gem "omniauth-twitter"


This gem is released under the MIT License.


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
You can’t perform that action at this time.