3

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.

krakover
  • 2,989
  • 2
  • 27
  • 29

2 Answers2

1

Check out the OmniAuth railscast for an awesome tutorial on how to integrate Facebook Connect with devise. Good luck!

Sam Ritchie
  • 10,988
  • 4
  • 42
  • 53
  • 1
    Devise on its own doesn't do FBConnect - you must be using a plugin. You'll need a similar plugin/gem for linkedin, or you can use something like Omniauth (see Sam's link) or Janrain's Engage service to integrate many such services easily. – Keith Gaddis Dec 03 '10 at 21:26
  • It actually does. Check out the example here: http://stackoverflow.com/questions/3580557/rails-3-using-devise-how-to-allow-someone-to-log-in-using-their-facebook-account – krakover Dec 04 '10 at 09:13