Setup multiple providers with devise :omniauthable

Luca G. Soave picture Luca G. Soave · Mar 24, 2011 · Viewed 8.6k times · Source

I just got "Devise 1.2 supports integration with OmniAuth tutorial" working but I'd like to setup multiple providers to refer the same user. I'm looking for some good sample code to look at.

I'm also not sure "multiple providers" is possible with default "devise :omniauthable" implementation and I'd like to reach the "one user many providers" effect, like described by Ryan Bates 235-omniauth-part-1, 236-omniauth-part-2 but I'm asking if a cleaner way, less hacked mixed models, could be possible in your opinion and may be, if you already know some examples.

thanks in advance luca

Answer

Markus Proske picture Markus Proske · Mar 25, 2011

As you are asking for code: I have written an article on Devise+Omniauth, that is quite long and consists of source and explainations. It is located here: http://www.communityguides.eu/articles/11. The approach taken is comparable to the Railscasts you mention.

My implementation of Devise with Omnitauth features multiple providers, Google, Facebook, Twitter and Github. However, I did not test this with Devise 1.2, I am still running 1.1.7. If you find it useful please let me know, if it works for Devise 1.2.

UPDATED jun 14 2011: ... see also, Omniauth pure: Authentication with Facebook, Google, Google Apps, Twitter, Github, AOL, MyOpenID, ... This article will demonstrate how to set up a multi-provider authentication using Omniauth only.