我可以使用导轨吗?打算将 linkedin 连接集成到我的网站吗?
我有一个使用 Devise 进行身份验证的 Rails 3 应用程序。
除了使用电子邮件进行手动身份验证之外,我还有一个 facebook 连接,允许使用 facebook 进行单点登录。
下一步是linkedin连接。有没有一种简单的方法可以将 linkedin API 调用集成到设计中?
(定义的天真的方法
<代码> config.oauth :linkedin, 'MY_APP_ID','MY_APP_SECRET',
:网站=> 'https://api.linkedin.com/',
:authorize_path => '/uas/oauth/授权',
:access_token_path => '/uas/oauth/accessToken'
config/initializers/devise.rb 中的配置导致 linkedin 出现“未提供授权令牌”错误消息。
谢谢!
更新: 感谢您(令人难以置信的)快速回复。我希望不必通过使用omniauth 或类似的解决方案来更改我的应用程序来添加linkedin 身份验证。但是,我现在看到 linkedin 响应不会返回电子邮件 - 这是我的用户的主键,因此我无法像使用 facebook 那样使用身份验证(在 Ryan 的解决方案中,他允许定义电子邮件如果没有从 Twitter 返回,则单独进行,但对于我的目的来说还不够好)。
另一个更新: Devise 现在拥有omniauth 支持,并且运行良好。 查看此链接。
I have a Rails 3 application using Devise for authentication.
In addition to the manual authentication using email, I also have a facebook connect that allows a single sign-in using facebook.
The next step is linkedin connect. Is there a simple way to integrate linkedin API call to devise?
(The naive approach of defining
config.oauth :linkedin, 'MY_APP_ID','MY_APP_SECRET',
:site => 'https://api.linkedin.com/',
:authorize_path => '/uas/oauth/authorize',
:access_token_path => '/uas/oauth/accessToken'
in the config/initializers/devise.rb resulted in "An Authorization Token was not supplied" error message from linkedin).
Thanks!
Update:
Thanks for the (incredibly) fast replies. I was hoping not to have to change my application to add the linkedin authentication, by using omniauth or a similiar solution. However, I now see that the linkedin response doesn't return the email - which is the used as the primary key for my users, and hence I cannot use the authentication the way I use facebook (In Ryan's solution he allows to define the email separately if not returned from twitter, but it's not good enough for my purposes).
Another Update:
Devise now has omniauth support, and it is working nicely.
Checkout this link.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看这个:
http://railscasts.com/episodes/235-omniauth-part-1
http://railscasts.com/episodes/236-omniauth-part-2
http://railscasts.com/episodes/241-simple-omniauth
look at this:
http://railscasts.com/episodes/235-omniauth-part-1
http://railscasts.com/episodes/236-omniauth-part-2
http://railscasts.com/episodes/241-simple-omniauth
查看 OmniAuthrailscast,了解有关如何将 Facebook Connect 与设备集成的精彩教程。祝你好运!
Check out the OmniAuth railscast for an awesome tutorial on how to integrate Facebook Connect with devise. Good luck!