Can I use rails' devise to integrate linkedin connect to my site?
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 omniau开发者_开发技巧th support, and it is working nicely. Checkout this link.
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
Check out the OmniAuth railscast for an awesome tutorial on how to integrate Facebook Connect with devise. Good luck!
精彩评论