Search code examples
ruby-on-railsrubyoauth-2.0linkedin-apiomniauth-linkedin

Oauth Login error while logging in using linkedin credentials ("error":"https_required")


I am using omniauth-linkedin-oauth2 (1.0.0) gem to login the users to our site using linkedin it was working fine until now not sure if its related to linkedin API changes or what

I am getting the below error

| (linkedin) Authentication failure! invalid_credentials: 
    OAuth2::Error, https_required: The client is not authorized
    {"error":"https_required","error_description":"The client is not authorized"}

Here's my configs:

  OmniAuth.config.logger = Rails.logger

  LINKEDIN_FIELDS =  ['id', 'first-name', 'last-name', 'picture-url', 'email-address', 'positions']

  Rails.application.config.middleware.use OmniAuth::Builder do

   provider :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET'], fields: LINKEDIN_FIELDS, secure_image_url: true

end

if Rails.env.development?
  OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
end

OmniAuth.config.on_failure = 
 Api::V2::UsersController.action(:linkedin_failure)

Solution

  • It now started working again. I think linkedin fixed it from there end.