Rails Omniauth for Linkedin not working

I am trying to get a Linkedin access token from Omniauth using Devise, Omniauth and omniauth-linkedin-oauth-2 . Either with facebook and twitter I can get an access token, but when I try to associate it, I get the following error in the omniauth callback:

ERROR -- omniauth: (linkedin) Authentication failure! invalid_credentials: OAuth2::Error, invalid_request: missing required parameters, includes an invalid parameter value, parameter more than once. : Unable to retrieve access token : appId or redirect uri does not match authorization code or authorization code expired {"error_description":"missing required parameters, includes an invalid parameter value, parameter more than once. : Unable to retrieve access token : appId or redirect uri does not match authorization code or authorization code expired","error":"invalid_request"} 

The linkedin app id and secret authentication work, since I get the omniauth callback, I don’t understand what the problem is.

Come up with the configuration below:

  config.omniauth :linkedin, ENV['LINKEDIN_APP_ID'], ENV['LINKEDIN_APP_SECRET'] 

Any ideas on what could happen?

+6
source share
1 answer

I had the same problem and found a way to solve this. In your Gemfile, specify this:

 #Contains a generic OAuth2 strategy for OmniAuth gem 'omniauth-oauth2', '~> 1.3.1' 

And finally do:

 bundle update 

I think it should work.

Additional information: https://github.com/intridea/omniauth-oauth2/issues/81

+10
source

All Articles