使用 devise :omniauthable 设置多个提供商
我刚刚得到 "Devise 1.2 支持与 OmniAuth 教程集成" 工作,但我'我想设置多个提供商来推荐同一用户。我正在寻找一些好的示例代码来查看。
我也不确定默认的“devise :omniauthable”实现是否可以实现“多个提供程序”,并且我希望达到“一个用户多个提供程序”的效果,如 Ryan Bates 235-omniauth-part-1,236-omniauth-part-2 但我想问的是,在您看来,是否有一种更清洁的方式,更少被黑客入侵的混合模型,并且可能是,如果您已经知道一些例子。
提前致谢 卢卡
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
正如您要求的代码:我写了一篇关于 Devise+Omniauth 的文章,这篇文章很长,由源代码和解释组成。它位于此处:http://www.communityguides.eu/articles/11。所采取的方法与您提到的 Railscasts 相当。
我使用 Omnitauth 实现的 Devise 具有多个提供商:Google、Facebook、Twitter 和 Github。但是,我没有使用 Devise 1.2 对此进行测试,我仍在运行 1.1.7。如果您发现它有用,请告诉我它是否适用于 Devise 1.2。
2011 年 6 月 14 日更新:
...另请参阅Omniauth pure:使用 Facebook、Google、Google Apps、Twitter、Github、AOL、MyOpenID 进行身份验证,...< /a> 本文将演示如何仅使用 Omniauth 设置多提供商身份验证。
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.