RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: dpassage
I had this problem as well. The issue is that when Devise generates the migration for the users table, it includes a unique index on the email address. So you can't have more than one user with an email address of "", which is what you get when you get more than one non-local-auth user. Devise also sets up the schema so that email defaults to "", rather than null.
I solved it short-term like this:
class IndexOnEmailIsNotUnique < ActiveRecord::Migration
remove_index "users", :name =>"index_users_on_email"
add_index "users", ["email", "provider", "uid"], :name => "index_users_on_identity", :unique => true
remove_index "users", :name => "index_users_on_identity"
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
Basically, instead of just indexing on the email address, I index on the tuple of email, provider, and uid, since I only plan on allowing one provider per account.
This isn't perfect since it would allow the same email to be used with a Twitter login and a Facebook login, for instance. Not sure what it does to Devise if you change the default for email to null.