简体   繁体   中英

Can't get auth information from Linkedin

I'm working on authentication with LinkedIn. I don't know why but LinkedIn don't allow to sign in with suddenly. I can allow LinkedIn app but I can't get authentication information.

{"provider"=>"linkedin",
"uid"=>nil,
"info"=>
  {"name"=>nil,
  "email"=>nil,
  "nickname"=>nil,
  "first_name"=>nil,
  "last_name"=>nil,
  "location"=>nil,
  "description"=>nil,
  "image"=>nil,
  "phone"=>nil,
  "headline"=>nil,
  "industry"=>nil,
  "urls"=>{"public_profile"=>nil}},
"credentials"=>{"token"=>"facdxxx-xxx-xxxx-xxxx-xxxxxxxxx", "secret"=>"2xxxxx-xxxx-xxxx-xxxx-xxxxxxx"}}

omniauth_controller.rb

class OmniauthCallbacksController < Devise::OmniauthCallbacksController
    def linkedin
        @user = User.from_omniauth(request.env["omniauth.auth"].except("extra"))

        if @user.persisted?
            sign_in_and_redirect @user, event: :authentication
        else
            session["devise.user_attributes"] = @user.attributes
            redirect_to new_user_registration_url
        end
    end
end

Should I update LinkedIn application settings? I wonder it doesn't matter to the rails application...

Gemfile

gem 'omniauth-linkedin'

I use omniauth-linkedin .

When I register in February, I have permission like below.

But currently, Just three.

How can I add permissions on LinkedIn?

There's so many things that this could actually be, but here's one thing you can try; you may not have requested the correct access when you configured your application. Per the docs :

When requesting an authorization code in Step 2 of the OAuth 2.0 Guide, make sure to request the r_liteprofile and/or r_emailaddress scopes!

Per the documentation you can set these via the request, or thru the developer portal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM